private int find(E[] array,E element){
  int min=0;
  int max=array.length - 1;
  while (max >= min) {
    int mid=midpoint(min,max);
    int compare=comparator.compare(array[mid],element);
    if (0 == compare) {
      return mid;
    }
    min=(compare < 0) ? mid + 1 : min;
    max=(compare > 0) ? mid - 1 : max;
  }
  return -1;
}

private int find ( E [ ] array , E element ) { int min = 0 ; int max = array . length - 1 ; while ( max >= min ) { int mid = midpoint ( min , max ) ; int compare = comparator . compare ( array [ mid ] , element ) ; if ( 0 == compare ) { return mid ; } min = ( compare < 0 ) ? mid + 1 : min ; max = ( compare > 0 ) ? mid - 1 : max ; } return - 1 ; }
finds index for an element in the array . if the element does not exists by comparator it will return negative value .
