Arrays.sort(Object [] a, int fromIndex, int toIndex) has the following syntax.
public static void sort(Object [] a, int fromIndex, int toIndex)
In the following code shows how to use Arrays.sort(Object [] a, int fromIndex, int toIndex) method.
/*from w w w .java2 s . co m*/ import java.util.Arrays; public class Main { public static void main(String[] args) { // initializing unsorted Object array Object ob[] = {27, 11, 5, 44,22,0}; System.out.println(Arrays.toString(ob)); // sorting array from index 1 to 3 Arrays.sort(ob, 1, 3); System.out.println(Arrays.toString(ob)); } }
The code above generates the following result.