My logic in this program was to compare values and store the values with the highest frequencies using maxFreq. If I have two of the same highest frequencies, then the computer should display "No mode", but I got very confused after a while because I might have several modes and I think that I might even have to use extra loops to loop through the frequencies of values to compare the frequencies of the modes.
public static void printStatistics(ArrayList<Integer> list) { double sum = 0; double maxFreq = 0; int freq = 1; for (int i = 0; i < list.size(); i++) { sum += list.get(i); for (int j = i + 1; j < list.size(); j++) { //compare the max freq and freq count if (list.get(i) == list.get(j)) { freq++; if (maxFreq < freq) { maxFreq = freq; freq = 1; } else { freq = 1; } } } } }