So I have the following code
StringTokenizer st = new StringTokenizer(sb.toString());
while (st.hasMoreElements())
{
String next = st.nextElement().toString();
int nextInt = Integer.parseInt(next);
agents = Integer.parseInt(next);
pass = Integer.parseInt(next);
TSA[] agentArr = new TSA[agents];
for(int i; i < agents; i++)
{
agentArr[i] = new TSA(next,next,nextInt,nextInt,nextInt,nextInt,nextInt,nextInt,nextInt,nextInt,nextInt);
}
}
Now this works for what I am doing because I was expecting only to have a fixed number of nextInt's that I would be reading from a file. However I realized I would have to read an unknown amount, from two separate lines of unknown length. I cannot figure out how to do this using StringTokenizer, ideally I could check when a new line occured and take the next token as an array but am unable to do this. Any ideas? Also I know that String Tokenizer is deprecated and is not the best way. I am open to using other ways, but still could not get it to work.