Update the BinarySearch Algorithm in Java