static int findMostFrequentInt(int[] array) {
        Map<Integer, Integer> map = new HashMap<Integer, Integer>();
        for (int i=0; i<array.length; i++) {
            if (map.containsKey(array[i])) {
                map.put(array[i], map.get(array[i]) +1);
            } else {
                map.put(array[i], 1);
            }
        }
        int sum=0;
        int largest = 0;
        for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
            int newSum = entry.getValue();
            if (newSum > sum) {
                sum = newSum;
                largest = entry.getKey();
            }
        }
        return largest;
    }