Помогите разобраться, что я делаю не так.
Выводится пустой массив.
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader (System.in));
String str = reader.readLine();
ArrayList<Integer> mainList = new ArrayList<>();
ArrayList<Integer> byteList1 = new ArrayList<>();
ArrayList<Integer> byteList2 = new ArrayList<>();
FileInputStream inputStream = new FileInputStream(str);
while (inputStream.available() > 0){
mainList.add(inputStream.read());
}
for (int x = 0; x < mainList.size(); x++){
for (int i = 0; i < mainList.size(); i++){
if (mainList.get(x).equals(mainList.get(i)))
byteList1.add(mainList.get(i));
}
if (byteList1.size() > byteList2.size())
byteList2 = byteList1;
byteList1.clear();
}
inputStream.close();
System.out.println(byteList2);
}
}