code: protected int binarySearch (int key)
      {
          int low = 0;
          int high = _size-1;
  
          while (low <= high) {
              int mid = (low + high) >>> 1;
              int midVal = _values[mid];
  
              if (midVal < key) {
                  low = mid + 1;
              } else if (midVal > key) {
                  high = mid - 1;
              } else {
                  return mid; // key found
              }
          }
  
          return -(low + 1);  // key not found.
      }
docs: Performs a binary search on our values array, looking for the specified value. Swiped from
  <code>java.util.Arrays</code> because those wankers didn't provide a means by which to
  perform a binary search on a subset of an array.