Finding pairs out of five
<p>I am having trouble finding pairs in a string of size five. So therefore, there can only be two pairs. For every pair that I have found, I should increase the score by 2 points.
Here is what I have so far, but it is incorrect.</p>

<pre><code>  String  temp = "4 5 4 3 3";
  String  tempLine = temp.replaceAll(" ", "");
  String[]  hand = temp.split(" ");
        for(int i = 0; i &lt; hand.length; i++)
                  {

                      if(hand[i].equals(tempLine.substring(0, 1)) &amp;&amp; i !=0 )
                          score += 1;
                      if(hand[i].equals(tempLine.substring(1, 2)) &amp;&amp; i != 1 )
                          score += 1;
                      if(hand[i].equals(tempLine.substring(2, 3)) &amp;&amp; i!= 2 )
                          score += 1;
                      if(hand[i].equals(tempLine.substring(3, 4)) &amp;&amp; i!= 3)
                          score += 1;
                      if(hand[i].equals(tempLine.substring(4)) &amp;&amp; i != 4)
                          score += 1;

                  }
</code></pre>

<p><strong>EDIT: I am trying to find pairs in the hand that have similar value, for example 4 would be one pair found in this hand</strong> </p>
