public static int indexOf (int[] values, int value)
    {
        int count = (values == null) ? 0 : values.length;
        for (int ii = 0; ii < count; ii++) {
            if (values[ii] == value) {
                return ii;
            }
        }
        return -1;
    }
public static int indexOf ( int [ ] values , int value ) { int count = ( values == null ) ? 0 : values . length ; for ( int ii = 0 ; ii < count ; ii ++ ) { if ( values [ ii ] == value ) { return ii ; } } return - 1 ; }
Looks for an element that is equal to the supplied value and returns its index in the array.

@return the index of the first matching value if one was found, 1 otherwise.