Wanted to verify that this actually does check for all wins- if so I need to a statement that a tie does still exist and where to add it...Opinions and suggestions please.. method displayHandName() writes out the hand found.
public static void determineWinner(int[] finalHands, int[][] hands) throws
IOException
{
int maxHand = 0; // The best hand value seen so far.
int winner = 0; // The winner.
// Look at each player's hand to find the winner.
for (int i = 0; i < NUM_PLAYERS; i++) {
// The current player has the best hand so far.
if (finalHands[i] > maxHand) {
maxHand = finalHands[i];
winner = i;
}
// The current player is tied with the best hand so far...
else if (finalHands[i] == maxHand)
// ... but wins on the tiebreak.
if (hands[i][0] > hands[winner][0]) {
maxHand = finalHands[i];
winner = i;
}
}
System.out.println("Hit return to see who won...");
stdin.readLine();
System.out.println("----------------------------------------------
\n");
System.out.println("PLAYER " + (winner+1) + ", YOU WIN!!!");
displayHandName(maxHand);
}