title: Scanner is not stopping
body: <p>Please have a look at the following code. It is my attempt to manage the given numbers in ascending order.</p>
  
  <pre><code>import java.io.*;
  import java.util.*;
  import java.util.ArrayList;
  
  public class TurboSort
  {
      public static void main(String[]args)
      {
  
          List&lt;Integer&gt; numbers = new ArrayList();        
          Scanner scan = new Scanner(System.in);
  
          while(scan.hasNextInt())
          {
              numbers.add(scan.nextInt());
          }
  
  
          Collections.sort(numbers);
  
          System.out.println(numbers);
      }
  }
  </code></pre>
  
  <p>insert the input as 2,1,6,7,3</p>
  
  <p>Hit enter.</p>
  
  <p>Now, the scanner hasn't exited from the while loop because it is not giving any output. What am I doing here wrong? Even if you manage to get it, the output is surrounded by brackets like " [1] [2] [3] ". Why is that? Is that is because I didn't call 'Integer.parseInt()' ?. Please help me with those 2 questions. </p>
  
  <p>Thanks.</p>