private static int findCommandIndex ( String [ ] args ) { int commandIndex = - 1 ; for ( int i = 0 ; i < args . length ; i ++ ) { for ( Command command : Command . values ( ) ) { if ( command . getName ( ) . equals ( args [ i ] . trim ( ) ) ) { commandIndex = i ; break ; } } } return commandIndex ; }
Looks for the index of command in the specified array .