How are you handling the suits of the deck? If you're representing the cards as simple ints, then I assume that the valid values of the cards are 0 - 51. If that's the case, then I guess cards 0 - 12 are all one suit, 13 - 25 are another, etc. Assignment of the suits can be arbitrary until you need to score hands that take it into account.
With this arrangement you can detect a pair just as samoz wrote, with a modification to your comparison operation. You'll need to make sure the cards are congruent modulo 13. Just change the line
if(hand[i] == hand[j])
to
if( (hand[i] % 13) == (hand[j] % 13) )
The modulus operator (%) returns the remainder after division, so
0 % 13 = 0
1 % 13 = 1
2 % 13 = 2
...
12 % 13 = 12
13 % 13 = 0
14 % 14 = 1
and so on... It allows you to tell when a sequence wraps around a certain value, the modulus, in this case 13, since there are 13 different cards in each of four suits.
Let's say, for example, that in your deck of 52 cards numbered 0 - 51 that the cards 0 - 12 represent the Ace through King of clubs, cards 13 - 25 represent the hearts, 26 - 38 represent spades, and 39 - 51 represent diamonds.
Now you're dealt the hand: 0, 12, 32, 21, 47
By taking the remainder modulus 13 of each card you're left with 0, 12, 6, 8, 8
You can see that the last two cards are a pair, the 9 of hearts and the 9 of diamonds (remember the numbering starts at 0, so it's off by one).