Подскажите, в чем беда?
package com.javarush.task.task18.task1823;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/*
Нити и байты
*/
public class Solution {
public static Map<String, Integer> resultMap = new HashMap<String, Integer>();
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
ArrayList<ReadThread> list = new ArrayList<>();
String s;
while (!((s = br.readLine()).equals("exit"))) {
list.add(new ReadThread(s));
}
for (ReadThread x : list) {
x.start();
x.join();
}
}
public static class ReadThread extends Thread {
String fl;
public ReadThread(String fileName) {
//implement constructor body
this.fl = fileName;
}
public void run() {
try {
Map <Integer,Integer> map = new HashMap<>();
FileInputStream fis = new FileInputStream(fl);
int maxval=0;
int maxkey=0;
while (fis.available() > 0) {
int a = fis.read();
if (map.containsKey(a)) {
int v = map.get(a) + 1;
map.replace(a,v);
if (maxval < v) {
maxval = v;
maxkey = a;
}
} else
map.put(a,1);
}
fis.close();
resultMap.put(fl,map.get(maxkey).intValue());
} catch (Exception e) {
e.printStackTrace();
}
}
// implement file reading here - реализуйте чтение из файла тут
}
}