что не так с решением?
package com.javarush.task.task18.task1823;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
/*
Нити и байты
*/
public class Solution {
public static Map<String, Integer> resultMap = new HashMap<String, Integer>();
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
while (true) {
String str = s.nextLine();
if (str.equals("exit")) break;
new ReadThread(str).start();
}
}
public static class ReadThread extends Thread {
private Map<Integer, Integer> tmp = new HashMap<>();
private String fileName;
FileInputStream fis;
public ReadThread(String fileName) {
this.fileName = fileName;
}
@Override
public void run() {
int count = 0;
int result = 0;
try {
fis = new FileInputStream(fileName);
while (fis.available() > 0) {
int b = fis.read();
if (!tmp.containsKey(b)) tmp.put(b, 1);
else tmp.put(b, tmp.get(b) + 1);
}
} catch (IOException e) {
e.printStackTrace();
}
// поиск байта, который встречается макс число раз
for (Map.Entry<Integer, Integer> pair : tmp.entrySet()) {
if (pair.getValue() > count) {
result = pair.getKey();
}
}
resultMap.put(fileName, result);
try {
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}