title: Creating a conditional statement to correspond with scanner input
body: <p>I'm developing a program for class.</p>
  
  <p>I need to read the user's input using the scanner class. 
  I then need to pass this data through to an array list with a while loop.
  Within my while loop, I need a conditional statement to check whether a 0 or a negative number is entered.<br>
  If the user inputs a negative number or a 0, the loop ends and the code moves onto the next process...</p>
  
  <p><strong>The problems I'm currently facing are:</strong> </p>
  
  <p>-All my input values are not being processed</p>
  
  <p>-I have to enter the value 0 3 times to exit the loop</p>
  
  <p>-0 is being passed through to my array list which I do not want</p>
  
  <p>Here's my code so far: </p>
  
  <pre><code>import java.util.*; 
  public class questionAvg3
  {
  public static void main(String[]args)
  {
  
  Scanner input_into = new Scanner(System.in);
  ArrayList&lt;Integer&gt; collector = new ArrayList&lt;Integer&gt;();
  System.out.println("Enter 0 or a negative number to end input");
  System.out.println("Enter a positive integer to populate the arraylist");
  
  
      while ((input_into.nextInt() !=0) || (input_into.nextInt() &lt; 0)){
      System.out.println("Type another int or exit");
          collector.add(input_into.nextInt());
      }
  
      int minValue = collector.get(0);
      int maxValue = collector.get(0); 
      //int avgValue = collector.get(0);
      //int total = 0;
      for(Integer i: collector){
          if( i &lt; minValue) minValue = i;
          if( i &gt; maxValue) maxValue = i;
      }       
      System.out.println("The max value int is: " + maxValue);
      System.out.println("The min value int is: " + minValue);
  
  }
  }
  </code></pre>