Everything seems fine, Then also don't know what's wrong with it?
package com.codegym.task.task18.task1803;
import java.io.FileInputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
/*
Most frequent bytes
#1 get user input from the keyboard and store in a String
#2 Take a String and create a file reading object
#3 use a file reading object to read all the bytes from the object and store them in a List<Integer>
#4 take a List of Integers and return a Map that has a correct count of each unique Integer
#5 take a Map of <Integer, Integer> and find out which key or keys have the greatest value
#6 output the results of step 5
*/
public class Solution {
public static void main(String[] args) throws Exception {
ArrayList<Integer> list = new ArrayList<Integer>();
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String str = reader.readLine();
int count = 0;
int max = 0;
FileInputStream fs = new FileInputStream(str);
Map<Integer, Integer> map = new HashMap<>();
while(fs.available() > 0){
list.add(fs.read());
}
for(int i = 0; i < list.size(); i++){
map.put(list.get(i), count);
count++;
}
fs. close();
for(Map.Entry<Integer,Integer> entry : map.entrySet()){
if(entry.getValue()>=max){
max = entry.getValue();
System.out.print(entry.getKey()+ " ");
}
}
}
}