Hello everyone, I'm having an issue where I cannot run my code for this example. IntelliJ gives me the following error:
This might be a problem on Codegym's end, or I could be doing something really dumb that I don't realize haha. But I cannot debug my code without being able to run it, so I cannot figure out why it is not validating. Any thoughts?
package com.codegym.task.task18.task1803;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
/*
Most frequent bytes
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
File file = new File(reader.readLine());
FileInputStream fis = new FileInputStream(file);
List<Integer> list1 = new ArrayList<>();
ArrayList<Character> symbols = new ArrayList<>();
ArrayList<Integer> frequencies = new ArrayList<>();
ArrayList<Integer> maximums = new ArrayList<>();
while (fis.available() > 0) {
list1.add(fis.read());
}
fis.close();
int max = 0;
for (int i = 0; i < 128; i++) {
char ascii = (char) i;
symbols.add(ascii);
int freq = Collections.frequency(list1, i);
frequencies.add(freq);
if (freq > max) {
max = freq;
}
}
for (Integer i : frequencies) {
if (max == i) {
maximums.add(frequencies.indexOf(i));
}
}
String s = "";
for (int i : maximums) {
s += ((char) symbols.get(i)) + " ";
}
String trimmed = s.trim();
System.out.println(trimmed);
}
}