I don't know where the issues whether it with thread or the method
help me if you find tha issue
package com.codegym.task.task18.task1823;
//import java.util.HashMap;
//import java.util.Map;
import java.io.FileInputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
import java.io.*;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
/*
Threads and bytes
*/
public class Solution {
public static Map<Integer,Integer> m = new HashMap<Integer,Integer>();
public static Map<String, Integer> resultMap = new HashMap<String, Integer>();
public static void main(String[] args) throws Exception{
BufferedReader b = new BufferedReader(new InputStreamReader(System.in));
while(true){
String s = b.readLine();
if(s.equals("exit"))
break;
else
{
ReadThread rt =new ReadThread(s);
rt.start();
}
}
}
public static class ReadThread extends Thread{
private String fileName;
public ReadThread(String fileName) {
// Implement constructor body
this.fileName = fileName;
}
// Implement file reading here
public void run(){
try{
FileInputStream f = new FileInputStream(fileName);
int c=1;
while(f.available()>0){
int i=f.read();
if(m.get(i)==null)
m.put(i,1);
else
m.put(i,m.get(i)+1);
}
f.close();
int max =0;
for(Map.Entry<Integer,Integer> e : m.entrySet()){
if(e.getValue()>max){
max =e.getValue();}
}
for(Map.Entry<Integer,Integer> e : m.entrySet()){
if((int)e.getValue()==(max)) {
resultMap.put(this.fileName,e.getKey());
}
}
}
catch(IOException f){}
}
}
}