Sorting in increasing order
Integer arr[] = {3,2,1,7};
Arrays.sort(arr,0,4);
System.out.println(Arrays.toString(arr));
In reverse order
Integer[] a = {9, 8, 7, 2, 3, 4, 1, 0, 6, 5};
Arrays.sort(a,0,4,Collections.reverseOrder());
for(int arr:a) {
System.out.print(arr + " ");
}