title: Using selection sort - java deck of cards
body: <p>I am going to start with the code that I have.</p>
  
  <pre><code>public class DeckOfCards2 {
    public static void main(String[] args) {
      int[] deck = new int[52];
      String[] suits = {"Spades", "Hearts", "Diamonds", "Clubs"};
      String[] ranks = {"Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King"};
  
      // Initialize cards
      for (int i = 0; i &lt; deck.length; i++) {
        deck[i] = i;
      }
  
      // Shuffle the cards
      for (int i = 0; i &lt; deck.length; i++) {
        int index = (int)(Math.random() * deck.length);
        int temp = deck[i];
        deck[i] = deck[index];
        deck[index] = temp;
      }
  
      // Display the all the cards
      for (int i = 0; i &lt; 52; i++) {
        String suit = suits[deck[i] / 13];
        String rank = ranks[deck[i] % 13];
        System.out.println( rank + " of " + suit);
      }
    }
  }
  </code></pre>
  
  <p>Here is what I'm trying to do and don't know how to do it. I am a beginner. I need help please:</p>
  
  <ul>
  <li>Create a array of random card. (already done)</li>
  <li>Output this array in a formatted print statement using a toString
  method (unsorted).(not done yet but I do know how to get this part.)</li>
  <li>Use the selection sort to sort your array.(don't know how.)</li>
  <li>Output a sorted array using the toString method.  Ascending
  alphabetical order: clubs (lowest), followed by diamonds, hearts, and
  spades (highest). (don't know how to get this order to print)This ranking is used in the game of bridge. </li>
  <li>Also print out the number iterations. (easy for me to put in)</li>
  </ul>