Two ways to get this done:
Collections.sort(myArray)
given elements inside myArray implements Comparable
Second
Collections.sort(myArray, new MyArrayElementComparator());
where MyArrayElementComparator
is Comparator
for elements inside myArray