main.java
/*******************************************************************************************
     * Binary Search
     * This function will take in an integer array, the left and right index, and the value one
     * is searching for. If it exists, the index of this value will be returned.
     *******************************************************************************************/
Binary Search
This function will take in an integer array, the left and right index, and the value one
is searching for. If it exists, the index of this value will be returned.
Binary Search This function will take in an integer array the left and right index and the value one is searching for . If it exists the index of this value will be returned .
public static int BinarySearch(int arr[], int left, int right, int value) {
        if (right >= left) {
            int middle = left + (right - left) / 2;
            if (arr[middle] == value) {
                return middle;
            }
            if (arr[middle] > value) {
                return BinarySearch(arr, left, (middle - 1), value);
            } else {
                return BinarySearch(arr, (middle + 1), right, value);
            }
        } else {
            return -1; 
        }
    }
public static int BinarySearch ( int arr [ ] , int left , int right , int value ) { if ( right >= left ) { int middle = left + ( right - left ) / 2 ; if ( arr [ middle ] == value ) { return middle ; } if ( arr [ middle ] > value ) { return BinarySearch ( arr , left , ( middle - 1 ) , value ) ; } else { return BinarySearch ( arr , ( middle + 1 ) , right , value ) ; } } else { return - 1 ; } }
Binary Search
 This function will take in an integer array, the left and right index, and the value one
 is searching for.
Binary Search This function will take in an integer array the left and right index and the value one is searching for .
// element value cannot be found in the input array