title: getting input from stdin
body: <p>I want to get input from stdin in the for of</p>
  
  <pre><code>3
  10 20 30
  </code></pre>
  
  <p>the first number is the amount of numbers in the second line. Here's what I got, but it is stuck in the while loop... so I believe. I ran in debug mode and the array is not getting assign any values...</p>
  
  <pre><code>import java.util.*;
  
  public class Tester {   
  
     public static void main (String[] args)
     {
  
         int testNum;
         int[] testCases;
  
         Scanner in = new Scanner(System.in);
  
         System.out.println("Enter test number");
         testNum = in.nextInt();
  
         testCases = new int[testNum];
  
         int i = 0;
  
         while(in.hasNextInt()) {
             testCases[i] = in.nextInt();
             i++;
         }
  
         for(Integer t : testCases) {
             if(t != null)
                 System.out.println(t.toString());               
         }
  
     } 
  
  } 
  </code></pre>