binarySearch(S[], n, key)
start <- 0
end <- n -1
WHILE start <= end
mid <- (start + end) / 2
IF S[mid] == key
RETURN mid
ELIF S[mid] < key
start <- mid + 1
ELIF S[mid] > key
end <- mid - 1
END WHILE
RETURN -1
binarySearch(S[], start, end, key)
IF start > end
RETURN -1
ELSE
mid <- (start + end) / 2
IF S[mid] == key
RETURN mid
ELIF S[mid] < key
RETURN binarySearch(S[], mid + 1, end, key)
ELSE
RETURN binarySearch(S[], start, mid - 1, key)
java.util.Arrays.binarySearch
int binarySearch(int[] a, int key)
int binarySearch(int[] a, int fromIndex, int toIndex, int key)