question: private int validMacro ( String s ) { int mN ; try { mN = Integer . parseInt ( s ) ; } catch ( NumberFormatException e ) { return - 1 ; } if ( mN < 0 || mN > maxNumMacros ) { return - 1 ; } else { return mN ; } }
target:  Check for valid macro, return number if valid, -1 if not.