code: protected int binarySearch(int value) {
  		int left = 0;
  		int right = size-1;
  		while(left <= right) {
  			int mid = (left + right)>>1;
  			int midValue = elementData[mid];
  			if(value==midValue) return mid;
  			if(value<midValue) right = mid-1;
  			else left = mid+1;
  		}
  		return -(left+1);
  	}
docs: Performs a binary search for the provide value.
  It will return any matching element, not necessarily
  the first or the last.