Arrays.sort(char[] a, int fromIndex, int toIndex) has the following syntax.
public static void sort(char[] a, int fromIndex, int toIndex)
In the following code shows how to use Arrays.sort(char[] a, int fromIndex, int toIndex) method.
/*from w ww . j a v a 2 s.c o m*/ import java.util.Arrays; public class Main { public static void main(String[] args) { char aArr[] = {'j','a','v','a'}; System.out.println(Arrays.toString(aArr)); // sorting array from index 0 to 3 Arrays.sort(aArr, 0, 3); System.out.println(Arrays.toString(aArr)); } }
The code above generates the following result.