Arrays class defines several utility methods for arrays.
It can be either primitive arrays or object arrays.

Sorting an array:

Array class defines the following methods for sorting.

  1. public static void sort(primitive[] array)
    To sort primitive array according to default natural sorting order.
  2. public static void sort(Object[] array)
    To sort object array according to default natural sorting order.
  3. public static void sort(Object[] array,Comparator c)
    To sort object array according to customized sorting order.