title: Java Couting Charcters using methods
body: <p>I am trying to get the first for loop into its own private method and i cant seem to get it without messing up to input. The goal is only to have the main method be used for calling methods and have all the actual calculations done in methods. </p>
  
  <p>Any guidance would be appreciated </p>
  
  <p>Here's part of my code:</p>
  
  <pre><code>import java.util.Arrays;
  import java.util.Scanner;
  
  public class CountChars {
  static int[] alphabetArray = new int[26];
  public static void main(String[] args) {
       int linenum = 0;
          Scanner input = new Scanner(System.in);
          while(input.hasNext()){
            String userInput =input.nextLine();
            String input1 = userInput.toLowerCase();
            for ( int i = 0; i &lt; input1.length(); i++ ) {
               char ch=  input1.charAt(i);
               int value = (int) ch;
               if (value &gt;= 97 &amp;&amp; value &lt;= 122){
               alphabetArray[ch-'a']++;
            }
          }
       int others= counts(++linenum, userInput);
      printLetterCounts();
      String yesorno= anyVowels(userInput);
      String VowCont= countVowels (userInput);
      int Contcount= countConsonants(0, userInput);
      zeroLetterCount();
      System.out.print(" others="+others); // ADDED THIS LINE
      System.out.println();    
  </code></pre>