title: Using string tokenizer to set create arrays out of a text file?
body: <p>Hey. You may have recently seen a post by me looking for help, but I did it wrong before, so I am going to start fresh and begin at the basics.</p>
  
  <p>I am trying to read a text file that looks like this:</p>
  
  <blockquote>
    <p>FTFFFTTFFTFT<br>
    3054 FTFFFTTFFTFT<br>
    4674 FTFTFFTTTFTF<br>
    ... etc</p>
  </blockquote>
  
  <p>What I need to do is put the first line into a String as the answer key.</p>
  
  <p>Next, I need to create an array with the student ID (the first numbers).
  Then, I need to create an array that is parallel to the student ID that contains the student's answers.</p>
  
  <p>Below is my code, and I can't quite figure out how to get it to work like this, and I was wondering if someone could help me out with it.</p>
  
  <pre><code>public static String[] getData() throws IOException {
        int[] studentID = new int[50];
        String[] studentAnswers = new String[50];
        int total = 0;
  
        String line = reader.readLine();
        strTkn = new StringTokenizer(line);
        String answerKey = strTkn.nextToken();
  
        while(line != null) {
          studentID[total] = Integer.parseInt(strTkn.nextToken());
          studentAnswers[total] = strTkn.nextToken();
          total++;
        }
      return studentAnswers;
      }
  </code></pre>
  
  <p>So at the end of the day, the array structure should look like:</p>
  
  <p>studentID[0] = 3054<br>
  studentID[1] = 4674<br>
  ... etc</p>
  
  <p>studentAnswers[0] = FTFFFTTFFTFT<br>
  studentAnswers[1] = FTFTFFTTTFTF</p>
  
  <p>Thanks :)</p>