Start New Discussion within our Software Development Community

Hey guys,

I'm trying to read from a file and put each column into it's corresponding array.

% P_ID     CPU_burst    I/O_burst     Priority
0           10              4             2
1            8              2             1
2           12              0             5

while ((Line=myInput.readLine()) != null) {
        		 StringTokenizer s = new StringTokenizer(Line);
                 pid[counter]= Integer.parseInt(s.nextToken().toString());
                 cpu[counter]= Integer.parseInt(s.nextToken().toString());
                 io[counter]= Integer.parseInt(s.nextToken().toString());
                 prior[counter]= Integer.parseInt(s.nextToken().toString());

This does not work, I'm thinking that the s.nexttoken is continuing past each line read in.
Any suggestions?

This question has already been answered. Start a new discussion instead.