public static int indexOf ( String ele , String [ ] arr ) { if ( arr == null ) { return - 1 ; } for ( int i = 0 ; i < arr . length ; i ++ ) { if ( arr [ i ] . equals ( ele ) ) { return i ; } } return - 1 ; }
check and search the specified element in the Array