title: Character count of textfile
body: <p>I'm looking to perform a character count on an all lowercase character .txt file in java, at present the print method end up blank when trying to print the count. Any help would be greatly appreciated.</p>
  
  <pre><code>public static void main(String[] args) throws IOException {
      File file1 = new File("newfile.txt");
      BufferedReader in = new BufferedReader (new FileReader (file1));
      System.out.println("Relative Letter Frequency");
  
      int ch;
      char i = 0;
      // Declare 26 char counting
      int[] count = new int[26];
      //Loop through the file char
      while ((ch = in.read()) != -1) {
      i = (char) ch;
          if (i &gt;= 'a' &amp;&amp; i &lt;= 'z')
          count[i - 'a']++;
      }
  
      //Print loop
      for (int j = 0; j &lt; 26; j++) {
          //Print formatting so each letter is represented on
          //a new line with correct spacing
          System.out.printf("%c %d \n", j + 'a', count[j]);
          System.out.println();
      }
  
      in.close();
  }
  
  int Counter(File file,String Charset) throws IOException {
          File file1 = new File("newfile.txt");
          BufferedReader in = new BufferedReader( new FileReader(file1));
  
          int Count = 0;
          while (in.read() &gt; -1){
              Count++;
  
          }
          System.out.println(Count);
          in.close();     
          return Count;
      }
  }
  </code></pre>
  
  <p>I've tried to change the loop for the character counter, but still to no avail</p>
  
  <pre><code>            public void Counter(File file,String Charset) throws IOException {
          File file1 = new File("newfile.txt");
          BufferedReader in = new BufferedReader(new FileReader(file1));
          int CH;
          char k = 0;
          int [] Count = new int [1];
          while ((CH = in.read()) != -1){
              k = (char) CH;
              if (k &gt;= 'a' &amp;&amp; k &lt;='z')
              Count [k]++;    
          }
      System.out.println(Count[k]);
          in.close();
      }
  </code></pre>