modified BinarySearch.java