Not satisfying the third requirement :(
package com.codegym.task.task18.task1803;
import java.io.FileInputStream;
import java.io.*;
import java.util.*;
/*
Most frequent bytes
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
FileInputStream fis = new FileInputStream(br.readLine());
HashMap<Integer,Integer> map = new HashMap<>();
List<Integer> list = new LinkedList<>();
int count = 0, max=0;
while(fis.available()>0){
int data = fis.read();
list.add(data);
for(int i =0; i<list.size(); i++){
for(int j=i+1; j<list.size(); j++){
if(list.get(i).equals(data)){
count++;
map.put(list.get(j),count);
}
max=count;
count=0;
}
}
}
for(Map.Entry<Integer,Integer> entry : map.entrySet()){
if(entry.getValue()==max){
System.out.print(entry.getKey() + " ");
}
}
fis.close();
}
}