Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void countFucker (File f) throws FileNotFoundException, IOException {
- BufferedReader in = new BufferedReader (new FileReader (f));
- System.out.println("Letter Frequency inf file " +f);
- int nextChar;
- char ch = 0;
- int[] count = new int[26];
- while ((nextChar = in.read()) != -1) {
- ch = Character.toLowerCase(ch);
- ch = ((char) nextChar);
- if (ch >= 'a' && ch <= 'z')
- count[ch - 'a']++;
- }
- for (int i = 0; i < 26; i++) {
- System.out.printf("%c %d,", i + 'A', count[i]);
- }
- in.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement