title: How to use arrays in a leap year finder
body: <p>I am trying to create a program that can take input of multiple leap years ina row through an array and then output whether they are leap years or not on their own separate lines. I can't seem to figure out the problem. Here is my code.</p>
  
  <pre><code>import java.util.Scanner;
  
  public class LeapYear2 {
  
      static boolean[] leapYearStatus = new boolean[10];
  
      public static void main(String[] args) {
          System.out.println("Enter consecutive years above 1582 with");
          System.out.println("spaces separating them then press enter.");
  
          Scanner scan = new Scanner(System.in);
          String input = scan.nextLine()+ " ";
          String[] inputString = new String[input.length()/5];
          int[] inputValues = new int[input.length()/5];
          inputString = input.split("\\s+");
  
          for (int i =0; i &lt; input.length()/5;i++)
              inputValues[i] = Integer.parseInt(inputString[i]);
  
          LeapYear2 check = new LeapYear2();
  
          check.checkLeap(inputValues);
          check.output(leapYearStatus, inputValues);
          scan.close();
      }
  
      public void checkLeap(int value[]) {
          for (int i = 0; i &lt; value.length; i++) {
              if (value[i] % 4 == 0)
                  if (value[i] % 400 == 0)
                      leapYearStatus[i] = true;
                  else if (value[i] % 100 == 0)
                      leapYearStatus[i] = false;
  
          }
      }
  
      public void output(boolean[] leapYearStatus, int value[]) {
          for(int i = 0; i &lt; value.length; i++)
              if(leapYearStatus[i] &amp;&amp; value[i] &gt; 1582){
                  System.out.println(value[i] + " is a leap year!");
              }else if(!leapYearStatus[i] &amp;&amp; value[i] &gt; 1582 ){
                  System.out.println(value[i] + " is not a leap year.");
              }else {
                  System.out.println(value[i] + " is too small! (&lt;= 1582)");
              }
      }
  
  }
  </code></pre>