title: Reading only Integers from a text file and store it in an array
body: <p>Reading only Integers from a text file and storing in an array and display it to user</p>
  
  <p>How can i read only integers from a text file that contains both Integers ans Strings..</p>
  
  <p>Suppose i have a text file like this..</p>
  
  <pre><code>10 10 100 100 Line
  10 20 15 30 Rectangle
  100 50 50 Circle
  10 10 50 50 Line
  0 0 0 xyz
  </code></pre>
  
  <p>We should search each token and if we find some meaningful letter Line,Rectangle,Circle
  the integers information of that particular Shape should be stored in an array how is this possible..</p>
  
  <pre><code>Scanner s = new Scanner (new File ("a.txt")).useDelimiter("\\s+");
  while (s.hasNext()) {
      if (s.hasNextInt()) { // check if next token is an int
          System.out.print(s.nextInt()); // display the found integer
      } else {
          s.next(); // else read the next token
      }
  }        
  </code></pre>