title: Deck of Cards Shuffle
body: <p>I'm trying to test out my two functions in my Pack class to simulate a deck of cards. </p>
  
  <pre><code>public class Pack {
  
      private PlayingCard[] deck;   // An array of 52 cards, representing the deck.
      private int cardsUsed; // How many cards have been dealt from the deck.
  
      /**
      * Creating an unshuffled deck of cards
      */
      public Pack() {
         deck = new PlayingCard[51]; //Creates an array of 52 playing cards
         int cardCt = 0; // How many cards have been created so far.
         for ( int suit = 0; suit &lt;= 3; suit++ ) { //If a suit is complete, move to the next suit
            for ( int value = 1; value &lt;= 14; value++ ) { //Builds a complete suit
               deck[51] = new PlayingCard(value,suit);
               cardCt++; //Adds one to the card count
            }
         }
         cardCt = 0;
      }
  
      /**
      * Shuffling a deck of cards
      */
      public void shuffle() {
            // Put all the used cards back into the deck, and shuffle it into
            // a random order.
          for ( int i = 51; i &gt; 0; i-- ) { 
              int rand = (int)(Math.random()*(i+1));
              PlayingCard temp = deck[i];
              deck[i] = deck[rand];
              deck[rand] = temp;
          }
          cardsUsed = 0;
      }
  
      public @Override String toString()
      {
          return Pack();
      }
  
      } // end class Pack
  </code></pre>
  
  <p>I want it to look similar to how I've done my PlayingCard class, to keep it more formal.</p>
  
  <pre><code>public class PlayingCard {
  
      /**
      * Declaring Variables
      */
      private int rank;
      private int suit;
  
      /**
      * Declaring Non-Numerical Cards
      */
      public static final int jack = 11;
      public static final int queen = 12;
      public static final int king = 13;
      public static final int ace = 14;
  
      /**
      * Declaring Suits
      */
      public static final int clubs = 0;
      public static final int diamonds = 1;
      public static final int hearts = 2;
      public static final int spades = 3;
  
      /**
      * Constructs a card with specified initial rank and suit
      */
      public PlayingCard(int rank, int suit)
      {
          this.rank=rank;
          this.suit=suit;
      }
  
      public int getSuit()
      {
          return suit;
      }
  
      public int getRank()
      {
          return rank;
      }
  
      /**
      * Switch Statements are use because there are many execution paths
      */
      public String getSuitAsString()
      {
          switch(suit)
          {
              case clubs: return "Clubs";
              case diamonds: return "Diamonds";
              case hearts: return "Hearts";
              case spades: return "Spades";
              default: return "ERR";
          }
      }
  
      /**
      * Switch Statements are use because there are many execution paths
      */
      public String getRankAsString()
      {
          switch(rank)
          {
              case 2: return "2";
              case 3: return "3";
              case 4: return "4";
              case 5: return "5";
              case 6: return "6";
              case 7: return "7";
              case 8: return "8";
              case 9: return "9";
              case 10: return "10";
              case 11: return "Jack";
              case 12: return "Queen";
              case 13: return "King";
              case 14: return "Ace";
              default: return "ERR";
          }
      }
  
      /**
      * toString Method
      */
      public @Override String toString()
      {
          return getRankAsString() + " of " + getSuitAsString();
      } 
  
      }
  </code></pre>
  
  <p>What I want to do is put the shuffle method into a toString method, like the PlayingCard class so I can then test it in my PackTester. I understand I can't return a void statement, and that's where I'm stuck. If someone could explain what to do, I'd really appreciate it.</p>