Java Utililty Methods Binary Search

List of utility methods to do Binary Search

Description

The list of methods to do Binary Search are organized into topic(s).

Method

intbinarySearchReversed(int[] a, int fromIndex, int toIndex, int key)
binary Search Reversed
int low = fromIndex;
int high = toIndex - 1;
while (low <= high) {
    int mid = (low + high) >>> 1;
    int midVal = a[mid];
    if (midVal > key)
        low = mid + 1;
    else if (midVal < key)
...
intbinarySearchStringArray(String[] array, String item, int first, int last)
binary Search String Array
if (last < first) {
    return -1;
int mid = (first + last) / 2;
if (array[mid].equals(item)) {
    return mid;
if (item.compareTo(array[mid]) < 0) {
...