public static int indexOf ( final Object [ ] array , final Comparable object ) { for ( int i = 0 ; i < array . length ; ++ i ) { if ( object . compareTo ( array [ i ] ) == 0 ) // FOUND return i ; } return - 1 ; }
This method is used to find an item in an array .