A sort() method defined in class Arrays in java.util.
public static void sort(Object a)
Sorts the specified array of objects into ascending order, according to the natural ordering of its elements.
All elements in the array must implement the Comparable interface. Furthermore, all elements in the array must be mutually comparable (that is, e1.compareTo(e2) must not throw a ClassCastException for any elements e1 and e2 in the array).
This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort. The sorting algorithm is a modified mergesort (in which the merge is omitted if the highest element in the low sublist is less than the lowest element in the high sublist). This algorithm offers guaranteed n*log(n) performance, and can approach linear performance on nearly sorted lists.
a - the array to be sorted.
ClassCastException - if the array contains elements that are not mutually comparable (for example,