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 line; while(! (line = reader.readLine()).equals("exit")){ Thread thread = new ReadThread(line); thread.start(); } reader.close(); System.out.println(resultMap.toString()); } public static class ReadThread extends Thread { String fileName; public ReadThread(String fileName) { this.fileName = fileName; //implement constructor body } public void run(){ try { FileInputStream stream = new FileInputStream(fileName); byte[] array = new byte[256]; while(stream.available() > 0){ ++array[stream.read()]; } //Arrays.sort(array); int max = 0; int z = 0; for(int m = 0; m < 256; m++){ if (array[m] > max){ max = array[m]; z = m; } } System.out.println((char) z); System.out.println( z); System.out.println( max); resultMap.put(fileName, max); stream.close(); } catch (IOException e) { e.printStackTrace(); } } // implement file reading here - реализуйте чтение из файла тут }