Делаю все вроде правильно, но валидатор против!
package com.javarush.task.task18.task1823;
import java.io.*;
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 IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String s;
while (!(s = reader.readLine()).equals("exit")){
ReadThread readThread = new ReadThread(s);
readThread.start();}
}
public static class ReadThread extends Thread {
private String fileName;
public ReadThread(String fileName) {
super(fileName);
this.fileName = fileName;//implement constructor body
}
public void run() {
try {FileInputStream fileInputStream = new FileInputStream(fileName);
byte [] bufer = new byte[fileInputStream.available()];
fileInputStream.read(bufer);
int [] ints = new int[fileInputStream.available()];
int i=0,j=0,max=0;
for (i=0; i<ints.length;i++)
ints[i]=1;
for(i=0;i<bufer.length;i++){
ints[i]=1;
for(j=i+1;j<bufer.length;j++)
if (bufer[i]==bufer[j])
ints[i]=ints[i]++;}
for(i=0;i<bufer.length;i++)
if (ints[i] > ints[max])
max=i;
resultMap.put(fileName, (int)bufer[max]);
fileInputStream.close();
} catch (FileNotFoundException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
}// implement file reading here - реализуйте чтение из файла тут