I have an array of characters
String a = \"badabcde\"; char[] chArr = a.toCharArray(); // \'b\',\'a\',\'d\',\'a\',\'b\',\'c\',\'d\',\'e\'
Use public static void sort(char[] a, int fromIndex, int toIndex) in Arrays class.
Arrays
In your example:
Arrays.sort(chArr,2,6); // note that fromIndex is inclusive // but toIndex is exclusive