I put information on right site of code whats happening in curent block of code, can someone looked and maybe help?
package pl.codegym.task.task18.task1821;
/*
Częstotliwość występowania symboli
*/
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
public class Solution {
public static void main(String[] args) throws IOException {
String nameFile = args[0]; //|
FileInputStream FIS = new FileInputStream(nameFile); //| Loading and
byte[] bytes = new byte[FIS.available()]; //| reading file
FIS.read(bytes); //|
ArrayList<Byte> bytes2 = new ArrayList<>(); //|
for (byte ll : bytes){ //|
bytes2.add(ll); //| Sorting readed bytes
} //| ( but this not working in requirments)
Collections.sort(bytes2); //|
ArrayList<Character> listaZnakow = new ArrayList<>(); //|
for (byte l : bytes2){ //| Changing byte on ASCII char
char q = (char)l; //| and puting them to the list
listaZnakow.add(q); //|
}
HashMap<Character, Integer> lista = new HashMap<>(); //|
for (Character s : listaZnakow){ //|
if (!lista.containsKey(s)){ //|
int m = 0; //| counting chars if the Map dosnt contein them already
for (Character ss : listaZnakow){ //| as a Key (and Value is the char count)
if (s==ss){ //|
m++; //|
} //|
} //|
lista.put(s,m); //| put unique char and his count to the map
} //|
} //|
for (Map.Entry<Character,Integer> para : lista.entrySet()){
System.out.println(para.getKey()+" "+para.getValue());
}
FIS.close();
}
}