title: Java Poker - comparing hands
body: <p>I probably have a bunch of other errors, but I just cannot figure out why my comparing of the hands isn't working. I can't get any sort of matches to count I know I can get into the two for loops, but I can't get into the:</p>
  
  <pre><code>if (currentHand1[i][1] == currentHand1[j][1]) {
      matches++;
  }
  </code></pre>
  
  <p>I just need help. with how to compare the values of the cards. Please, and thank you.</p>
  
  <pre><code>public static void disPlayIntro()
  {
      String prompt = "This program will generate \n"+
              " two hands of poker.\n\n"+
              " Both hands will be displayed\n\n"+
              " You will be asked if you wish to\n"+
              " have two more hands generated?\n"+
              " Enter anything but no to quit\n";;
  
              JOptionPane.showMessageDialog(null, prompt,"Generate Poker Hands",1);
  
  }
  
  public static void main(String[] args)
  {
      disPlayIntro();
      int [][] deck        = new int[13][4];
      int [][] currentHand1 = new int[5][2];
      int [][] currentHand2 = new int[5][2];
      int [][] found = new int [5][5];
      int foundCounter = 0;
      int suit = 0;
      int card = 0;
  
      String howWon = "";
      int matches = 0;
  
      String[] suits = {"Hearts", "Spades","Diamonds","Clubs"};
      String[] cards = {"Ace", "2","3","4","5","6","7","8","9","10","Jack","Queen","King"};
  
      Random randGen = new Random();
      do
      {
          String hand1 = "";
          //dealing hand 1
          for(int dex = 0; dex &lt; currentHand1.length; dex++)
          {
              boolean goodCard = false;
              while(!goodCard)
              {
                  int suit = randGen.nextInt(4);
                  int card = randGen.nextInt(13);
  
                  if( deck[card][suit] == 0)
                  {
                      goodCard = true;
                      deck[card][suit] = 1;
                      currentHand1[dex][0] = suit;
                      currentHand1[dex][1] = card;
  
  
                      //start loop through hand
                      for(int i = 0; i &lt; currentHand1[1].length-1;i++){
                          if(cards[card].equals(cards[card])){
  
                          }
                          //Start counting pairs
                          matches = 0;
                          for(int j = i+1; j &lt; currentHand1[1].length; j++){
                              if(currentHand1[i][1] == currentHand1[j][1]){
  
                                  //add later:
                                  //before incrementing matches, verify that this card has not been found
  
                                  matches++;
                              }
  
                          }
  
                          //find high card
  
  
  
                      }
  
                      hand1 += "     "+cards[card]+" of "+suits[suit]+"\n";
                      JOptionPane.showMessageDialog(null, matches, "matches", 1);
                  }
              }
          }
  
  
          String hand2 = "";
          //dealing hand 1
          for(int dex = 0; dex &lt; currentHand2.length; dex++)
          {
              boolean goodCard = false;
              while(!goodCard)
              {
                  suit = randGen.nextInt(4);
                  card = randGen.nextInt(13);
  
                  if( deck[card][suit] == 0)
                  {
                      goodCard = true;
                      deck[card][suit] = 1;
                      currentHand2[dex][0] = suit;
                      currentHand2[dex][1] = card;
  
                      hand2 += "     "+cards[card]+" of "+suits[suit]+"\n";
                  }
              }
          }
  
  
  
          /*if(matches == 2){
              howWon = "a pair: ";
          }
          else if (matches == 3){
              howWon = "3 of a kind: ";
          }
          else if (matches == 4){
              howWon = "4 of a kind: ";
          }*/
  
  
  
          String results = "The first hand of cards:\n\n"+hand1+"\n\n\n";
          results += "The second hand of cards:\n\n"+hand2+"\n";
          results += "Do you want another two hands?\nenter 'Y'  or 'N'";
          String ans = JOptionPane.showInputDialog(null,results,"Show hands",1);
  
          //  System.out.println(howWon);
  
          if(!ans.toUpperCase().equals("Y"))
          {
              JOptionPane.showMessageDialog(null, "Program terminating!","Generate Poker Hands",1);
              System.exit(0);
          }
  
      }while(true);
  }   
  </code></pre>