import java.util.Arrays; public class Main { public static void main(String[] args) { char charArray[] = { 'a', 'b', 'd', 'e' }; Arrays.sort(charArray); char searchValue = 'b'; System.out.println(Arrays.binarySearch(charArray, searchValue)); searchValue = 'z'; System.out.println(Arrays.binarySearch(charArray, searchValue)); } }