Sometimes you need to sort the elements in the logarithm group. Of course, you can write a proper sorting method by yourself. But since there is an arrays. Sort sorting method in the Java package, why not use it when there are few array elements?
Sorting an array
1. digit sorting
Int [] intarray = new int [] {4, 1, 3,-23};
Arrays. Sort (intarray );
Output: [-23, 1, 3, 4]
2. Sort strings in upper case and lower case
String [] strarray = new string [] {"Z", "A", "C"};
Arrays. Sort (strarray );
Output: [C, A, Z]
3. Strictly sort by alphabet, that is, ignore case-insensitive sort
Arrays. Sort (strarray, String. case_insensitive_order );
Output: [A, C, Z]
4. Reverse sorting, reverse-Order sort
Arrays. Sort (strarray, collections. reverseorder ());
Output: [Z, a, c]
5. Ignore case-insensitive reverse sorting case-insensitive reverse-Order sort
Arrays. Sort (strarray, String. case_insensitive_order );
Collections. Reverse (arrays. aslist (strarray ));
Output: [Z, C, A]