Вопрос к знатокам, почему не работает?
package com.javarush.task.task18.task1803;
/*
Самые частые байты
*/
import java.io.*;
import java.util.ArrayList;
public class Solution {
public static void main(String[] args) {
long[] bytes = new long[256];
ArrayList<Long> byteList = new ArrayList<>();
try (BufferedReader nameReader = new BufferedReader(new InputStreamReader(System.in));
FileInputStream fileReader = new FileInputStream(nameReader.readLine())) {
long oneByte;
while (( oneByte = fileReader.read())!=-1) {
bytes[(byte) oneByte]++;
}
long maxCount = 0;
for (int i = 0; i < bytes.length; i++) {
byteList.add(bytes[i]);
if (bytes[i] > maxCount) {
maxCount = bytes[i];
}
}
for (int i = 0; i < byteList.size(); i++) {
if (byteList.get(i) == maxCount) {
System.out.print(i + " ");
}
}
} catch (FileNotFoundException e) {
System.out.println("File do not find");
} catch (IOException e) {
System.out.println("IO");
}
}
}