org.apache.datasketches.quantilescommon

## Class BinarySearch

- java.lang.Object
- - org.apache.datasketches.quantilescommon.BinarySearch

    public final class BinarySearch
    extends Object

Contains common equality binary search algorithms.

Author:
  Lee Rhodes

### Constructor Summary

Constructors
Constructor and Description
`BinarySearch()`

### Method Summary

All Methods Static Methods Concrete Methods
`static int` `find(double[] arr, int low, int high, double v)` Binary Search for the index of the exact double value in the given search range.
`static int` `find(float[] arr, int low, int high, float v)` Binary Search for the index of the exact float value in the given search range.
`static int` `find(long[] arr, int low, int high, long v)` Binary Search for the index of the exact long value in the given search range.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### BinarySearch

    public BinarySearch()

### Method Detail

#### find

    public static int find(float[] arr,
                           int low,
                           int high,
                           float v)

Binary Search for the index of the exact float value in the given search range. If -1 is returned there are no values in the search range that equals the given value.

Parameters:
  `arr` - The given ordered array to search.
  `low` - the index of the lowest value of the search range
  `high` - the index of the highest value of the search range
  `v` - the value to search for
Returns:
  return the index of the value, if found, otherwise, return -1;

#### find

    public static int find(double[] arr,
                           int low,
                           int high,
                           double v)

Binary Search for the index of the exact double value in the given search range. If -1 is returned there are no values in the search range that equals the given value.

Parameters:
  `arr` - The given ordered array to search.
  `low` - the index of the lowest value of the search range
  `high` - the index of the highest value of the search range
  `v` - the value to search for
Returns:
  return the index of the value, if found, otherwise, return -1;

#### find

    public static int find(long[] arr,
                           int low,
                           int high,
                           long v)

Binary Search for the index of the exact long value in the given search range. If -1 is returned there are no values in the search range that equals the given value.

Parameters:
  `arr` - The given ordered array to search.
  `low` - the index of the lowest value of the search range
  `high` - the index of the highest value of the search range
  `v` - the value to search for
Returns:
  return the index of the value, if found, otherwise, return -1;