title: Java delimiter reading a text file
body: <p>I'm trying to read a text file with this format:</p>
  
  <pre><code>Array x
  1,3,5,4
  
  Array y
  12,13,15,11
  </code></pre>
  
  <p>and put it in two array, but I only want the integer.
  What delimiter should I use to ignore the String and the empty line?</p>
  
  <p>Here's my code in putting the int to arrays. By the way, I'm using scanner to read the file:</p>
  
  <pre><code>Scanner sc = null;
  
       try
       {
       sc = new Scanner(new FileInputStream("C:\\x.txt"));
       sc.useDelimiter("");  // What will I put inside a quote to get only the int values?
       }
       catch(Exception e)
       {
       System.out.println("file not found!");
       }
  int[] xArray = new int[4];
  int[] yArray = new int[4];
  
       while (sc.hasNextInt( )){
           for(int i=0; i&lt;4; i++){
              xArray[i] = sc.nextInt( );
          }
           for(int i=0; i&lt;4; i++){
              yArray[i] = sc.nextInt( );
          }
      }
  </code></pre>
  
  <p>What I want to get is</p>
  
  <pre><code>int[] xArray = {1,3,5,4}
  int[] yArray = {12,13,15,11}
  </code></pre>
  
  <p>I hope you understand :)</p>
  
  <p>Thanks.</p>