What is wrong there ? Please help
package pl.codegym.task.task18.task1803;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
FileInputStream fileInputStream = new FileInputStream(reader.readLine());
List<Integer> lista = new ArrayList<>();
while(fileInputStream.available() > 0){
int c = fileInputStream.read();
lista.add(c);
}
fileInputStream.close();
int d = mostCommon(lista);
System.out.print(d);
}
public static <T> T mostCommon(List<T> list) {
Map<T, Integer> map = new HashMap<>();
for (T t : list) {
Integer val = map.get(t);
map.put(t, val == null ? 1 : val + 1);
}
Map.Entry<T, Integer> max = null;
for (Map.Entry<T, Integer> e : map.entrySet()) {
if (max == null || e.getValue() > max.getValue())
max = e;
}
return max.getKey();
}
}