title: file manipulation using tokenizer
body: <pre><code>import java.io.*;
  import java.util.Scanner;
  import java.util.StringTokenizer;
  
  public class Filereader {
      public static void main(String[] args) throws IOException {
  
  File fil = new File("trans1.txt");
  FileReader inputFil = new FileReader(fil);
  BufferedReader in = new BufferedReader(inputFil);
  
  //Create scanner to read contents of a file
  Scanner scanner = new Scanner(new File("trans1.txt"));
  
  //Create an array to store contents of a file after reading them
  String [] tall = new String [100];
  
  int i = 0;
  
  while(scanner.hasNext()){
  //Create StringTokenizer object
     StringTokenizer st = new StringTokenizer(scanner.next(),"&lt; , { } &gt;", true);
     tall[i] = scanner.next();
     System.out.println(tall[i]);
     i++;
    }
      in.close();
    }
   }
  </code></pre>
  
  <p>I want to read contents of a file into an array using the code above and print the values stored in the array to screen. Each time i run the code i dont get the desired output,can someone please help. Contents of my file are as follows;</p>
  
  <pre><code>5 
  &lt;0,{p1}&gt;
  &lt;0,{p1}&gt;  -1-&gt; &lt;1&gt;
  &lt;1,{p1}&gt;  -2-&gt; &lt;2&gt;&lt;3&gt;
  &lt;2,{p0}&gt;  -1-&gt; &lt;0&gt;
  &lt;3,{p1}&gt;  -1-&gt; &lt;4&gt;
  &lt;4,{p0}&gt;  -1-&gt; &lt;3&gt;
  </code></pre>