I'm having a bit of trouble working out what sort of loop to use in a program I'm writing.
Basically, I have a file with 2 lists of numbers separated by ";" e.g.
on so on up to 4076!
What I want to do is to collect together all the magnitudes that have the same name (i.e. 2714) and put them in an array so I can sort the order of them. (so I have one array containing all the magnitudes for 2713, one for 2714, etc)
I'm reading in one line at a time in a while loop and separating using StringTokenizer. But I can't work out how to put in a loop (or something) that will put the magnitude into an array if its name equals the first number, and if not, increase the number to be the same as the next name and start a new array.
Would be great if someone could help me out! Don't know if it can be done or if I'm making it too complicated. Hope I'm making some sense!