title: Short code to solve this java string and number situation
body: <p>i came across this problem whereas user need to enter a certain series of number in one input, then the program will output back the number one by one. For example, the user entered 4 6 8, then the program will output 4 6 8 to the user.</p>
  
  <p>The code that i have done is like this :</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.Scanner;
  
  public class Main {
  
      public static void main(String[] args) {
          int N;
          String num;
  
          Scanner in = new Scanner(System.in);
  
              System.out.println("Enter number:");
              num = in.nextLine();
  
              ArrayList&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;();
  
              for(int x = 0; x &lt; num.length(); x++)
              {
                 char c = num.charAt(x);
  
                 if(Character.getNumericValue(c) &gt;= 0 ){
                     numbers.add(Character.getNumericValue(c));
                 }
  
              }
  
              for(int n=0; n&lt;numbers.size(); n++){
  
                   System.out.println(numbers.get(n));
              }
  
      }
  }
  </code></pre>
  
  <p>But i think it is not really efficient as it is quite long for just doing a simple task. So, could you suggest anything that is much simpler? Thanks!</p>