for(int y = 1; y < 5; y++){ if(p0kerHand[x].getRank() == p0kerHand[y].getRank()){ //if rank of 2nd, 3rd, 4th, card is the same as first c0unter++; } else ; if(OfAKind < c0unter){ OfAKind = c0unter; } else; } } output: post sort Rank: 0 Suit: 1 post sort Rank: 8 Suit: 2 post sort Rank: 10 Suit: 2 post sort Rank: 12 Suit: 1 post sort Rank: 12 Suit: 0 Hand Type is: Bust clearly p0kerHand[4] == p0kerHand[5]