I have an array of characters
String a = \"badabcde\"; char[] chArr = a.toCharArray(); // \'b\',\'a\',\'d\',\'a\',\'b\',\'c\',\'d\',\'e\'
Use Arrays.sort([], int startIndex, int endIndex).
String a = "badabcde"; char[] chArr = a.toCharArray(); // 'b','a','d','a','b','c','d','e' Arrays.sort(chArr, 2, 5); System.out.println(new String(chArr)); // this prints baabdcde