title: Dice Poker Score Algorithm?
body: <p>Trying to get these algorithms to evaluate an array filled with five randomly chosen integers ranging from 1-6. Unfortunately, it will only return the high card and one pair options. How do I access the higher scores when I roll a two pair, three of a kind, etc.?</p>
  
  <pre><code>private static int[] getCounts(int[] dice) {
  
      int[] counts = new int[6];
      String resValue = "";
      for (int i = 0; i &lt; dice.length; i++) {
          if (dice[i] == 1) {
              counts[0]++;
          } else if (dice[i] == 2) {
              counts[1]++;
          } else if (dice[i] == 3) {
              counts[2]++;
          } else if (dice[i] == 4) {
              counts[3]++;
          } else if (dice[i] == 5) {
              counts[4]++;
          } else if (dice[i] == 6) {
              counts[5]++;
          }
      }
      return counts;
  }
  
  private static String getResult(int[] dice) {
      int[] counts = getCounts(dice);
      String resValue = " ";
  
      for (int i = 0; i &lt; counts.length; i++) {
          if (counts[i] == 5) {
              resValue = "Five of a kind ";
          } else if (counts[i] == 4) {
              resValue = "Four of a kind ";
          } else if (counts[i] == 3) {
              for (int j = 0; j &lt; counts.length; j++) {
                  if (counts[j] == 2) {
                      resValue = "Full House ";
                  }
              }
              resValue = "Three of a Kind ";
          } else if (counts[i] == 2) {
              for (int j = 0; j &lt; counts.length; j++) {
                  if (counts[j] == 2) {
                      resValue = "Two Pairs ";
                  }
              }
              resValue = "One Pair ";
          } else {
              resValue = "Highest Card ";
          }
      }
      return resValue;
  }
  </code></pre>