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.
2.1m questions
2.1m answers
60 comments
57.0k users