title: parsing numbers from a text file
body: <p>just wondering what i am doing wrong here. i am trying to read from a file and parse through some data. i keep getting error "java.lang.NumberFormatException" that it can't parse the numbers. I know i use getNextDouble() or get nextInt() but im trying to keep the code as general as i can. Any thoughts would be greatly appreciated. ty.</p>
  
  <p>here is a sample of a line from my text file:</p>
  
  <pre><code>       foo Bar 19.35 55 987.0054 4 
  
  public void readFile(){
          int i=0;
          String line;
  
          try{
              fileIn = new Scanner(new File("pa1Names.txt"));
          }catch(Exception e){
              System.out.println("Fatal Error: File was not opened");
          }
  
          while(i&lt;names.length &amp;&amp; fileIn.hasNext()){
              line = fileIn.nextLine();
              StringTokenizer st = new StringTokenizer(line);
              int m = st.countTokens();
  
              names[i] = st.nextToken();
  
              for (int k = 0; k&lt;m-5; k++)
              {
                  names[i] = names[i] + " " + st.nextToken();
              }
  
              reals[i][0] = Double.parseDouble(st.nextToken());
              ints[i][0]  = Integer.parseInt(st.nextToken());
              reals[i][1] = Double.parseDouble(st.nextToken());
              ints[i][1]  = Integer.parseInt(st.nextToken());
  
              i++;
          }//end while
          fileIn.close();
      }
  </code></pre>