@Override
	public int indexOf(int elem) {
		// Find the location to insert the object at
		int pos=binarySearch(elem);

		// Not found
		if(pos<0) return -1;

		// Found one, iterate backwards to the first one
		while(pos>0 && elementData[pos-1]==elem) pos--;
		return pos;
	}
@ Override public int indexOf ( int elem ) { int pos = binarySearch ( elem ) ; if ( pos < 0 ) return - 1 ; while ( pos > 0 && elementData [ pos - 1 ] == elem ) pos -- ; return pos ; }
Searches for the first occurrence of the given value.

@param   elem   the value
@return  the index of the first occurrence of the argument in this
list; returns <tt>-1</tt> if the object is not found.