Комменты читал. Вопросы читал. Может я упускаю мелкую, но важную деталь?
package com.javarush.task.task18.task1823;
import java.io.*;
import java.util.*;
/*
Нити и байты
*/
public class Solution {
public static Map<String, Integer> resultMap = new HashMap<String, Integer>();
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String str = reader.readLine();
while (!str.equals("exit")) {
Thread thread = new ReadThread(str);
thread.start();
str = reader.readLine();
}
reader.close();
}
public static class ReadThread extends Thread {
FileInputStream file;
String fileName;
public ReadThread(String fileName) throws FileNotFoundException {
file = new FileInputStream(fileName);
this.fileName = fileName;
}
@Override
public void run() {
try {
int[] buff = new int[256];
while (file.available() > 0) {
int data = file.read();
for (int i = 0; i < 256; i++) {
if (data == i) buff[i]++;
}
}
int symbol = 0;
for (int i = 0; i < 256; i++) {
if (buff[i] > symbol) symbol = i;
}
for (int i = 0; i < 256; i++) {
System.out.println(i + ": " + buff[i]);
}
System.out.println(symbol);
resultMap.put(fileName, symbol);
file.close();
} catch (IOException e) { e.printStackTrace(); }
}
}
}