I have a sequences of numbers in String and I want to sort them. For example:
From: 3,4,16;1,5,16,18,19;12,14,15,17;6,10,11;
To: 1,5,16,18,19;3,4,16;6,10,11;12,14,15,17;
My code:
String test = "3,4,16;1,5,16,18,19;12,14,15,17;6,10,11;";
String sortedTest[] = test.split(";");
Arrays.sort(sortedTest);
for(String i: sortedTest)
System.out.print(i +";");
But obviously when I use Array.sort() on this I get:
12,14,15,17;1,5,16,18,19;3,4,16;6,10,11;
How can I get it sorted like in example?