There is obviously something wrong with the verification system but there also might be something wrong with my code. Any help is appreciated.
package com.codegym.task.task18.task1821;
/*
Symbol frequency
*/
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.util.Map;
import java.util.TreeMap;
public class Solution {
public static void main(String[] args) throws IOException {
//using FileReader instead of FileInputStream
FileReader file1 = new FileReader(args[0]);
Map<Character, Integer> symbolFrequency = new TreeMap<>();
while (file1.ready()){
int a = file1.read();
if(symbolFrequency.containsKey(a)){
int frequency = symbolFrequency.get(a).intValue() + 1;
symbolFrequency.put((char) a, frequency);
} else {
symbolFrequency.put((char) a, 1);
}
}
file1.close();
for (Map.Entry<Character, Integer> pair : symbolFrequency.entrySet()){
System.out.println(pair.getKey() + " " + pair.getValue());
}
}
}