Please help
package com.codegym.task.task18.task1804;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/*
Rarest bytes
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String file1 = reader.readLine();
reader.close();
ArrayList<Integer> list = new ArrayList<>();
HashMap<Integer,Integer> map = new HashMap<>();
FileInputStream fileInputStream = new FileInputStream(file1);
while (fileInputStream.available() > 0) {
int data = fileInputStream.read();
list.get(data);
}
fileInputStream.close();
int min = Integer.MAX_VALUE;
int count = 0;
for (int i = 0; i<list.size(); i++) {
for (int j = 0; j<list.size(); j++) {
if (list.get(i)==list.get(j)) {
count++;
}
}
map.put(list.get(i),count);
count = 0;
}
for (HashMap.Entry<Integer,Integer> copy : map.entrySet()) {
if (copy.getValue()==min) {
System.out.print(copy.getKey()+" ");
}
}
}
}
/*Enter a file name from the console.
Find the byte or bytes with the minimum number of repetitions.
Display them on the screen, separated by spaces.
Close the IO stream.
Wymagania:
• The program should read a file name from the console.
• Use a FileInputStream to read from the file.
• All of the least frequently repeated bytes from the file should be displayed, separated by spaces.
• The screen output should be displayed in one line.
• The stream used to read the file must be closed.*/