private static int rankHands(Cards[] hands, Cards board, int numhands, int[] wins, int[] ties, int total) {
        List<HandRank> ranks = new ArrayList<HandRank>(numhands);
        HandRank highest = null;
        for (Cards hand : hands) {
            HandRank rank = holdem(hand, board);
            if (highest == null) {
                highest = rank;
            } else {
                if (rank.compareTo(highest) > 0) {
                    highest = rank;
                }
            }
            ranks.add(rank);
        }
        int handnum = 0;
        int tied = 0;
        for (HandRank rank : ranks) {
            if (rank.equals(highest)) {
                if (tied > 0) {
                    ties[handnum]++;
                } else {
                    wins[handnum]++;
                }
                tied++;
            }
            handnum++;
        }
        total++;
        return total;
    }