Really struggling to work this out…
I have a text file with data like this (17000 lines of it)
45226 1
45226 1
45226 1
45226 3
45226 5
23470 1
45226 5
45226 5
29610 4
37417 2
37417 3
37948 1
What I want to do is sort the text file (using java) so all the left numbers are grouped if the right value is 1.
or the left value is group if the right is not equal to 1 (so any other number).
for example (but doesn’t have to be like this)
3 x 45226 1
4 x 45226 MIXED
1 x 23470 1
1 x 29610 MIXED
2 x 37417 MIXED
1 x 37948 1
I know I may need to use array? or some sort of sort? but I just can’t work it out :'(
Any help, code or suggestions – greatly appreciated!
Thank you!
My code:
}