public static int getInt ( final String title , final int defaultValue ) { int opt ; do { try { final String val = ConsoleMenu . getString ( title + DEFAULT_TITLE + defaultValue + ")" ) ; if ( val . length ( ) == 0 ) { opt = defaultValue ; } else { opt = Integer . parseInt ( val ) ; } } catch ( final NumberFormatException e ) { opt = - 1 ; } } while ( opt == - 1 ) ; return opt ; }
Gets an int from the System . in