These numbers are stored in the same integer variable. How would I go about sorting the integers in order lowest to highest?
11367 11358 11421 11530 11491 11218 11789
There are two options, really:
E.g.,
int[] ints = {11367, 11358, 11421, 11530, 11491, 11218, 11789}; Arrays.sort(ints); System.out.println(Arrays.asList(ints));
That of course assumes that you already have your integers as an array. If you need to parse those first, look for String.split and Integer.parseInt.
1.4m articles
1.4m replys
5 comments
57.0k users