title: Array List for odd and even numbers stopping at -1
body: <p>I can't get my code to work. Im trying to get all the even and odd numbers of an array but I have to stop whenever i find a -1.</p>
  
  <pre><code>import java.util.*;
  public class EvenOdd{
    private static int[] array;
    private static List&lt;Integer&gt; even = new ArrayList&lt;&gt;();
    private static List&lt;Integer&gt; odd = new ArrayList&lt;&gt;();
    Scanner sc = new Scanner();
    int numbers = sc.nextInt();
  
    public static void classify() {
      for(int i = 0 ; i &lt; array.length ; i++){
        if(numbers==-1){
          if(array[i] % 2 == 0)
              even.add(array[i]);
  
          else
              odd.add(array[i]);
        }
      }
    }
  
    public static void display(List&lt;Integer&gt; list){
      for(Integer i : list)
          System.out.println(i);
    }
  
    public static void main(String[] args){
      classify();
      display(even);
    }
  }
  </code></pre>