code: 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;
      }
docs: Gets an int from the System.in
  @param title  for the command line
  @param defaultValue defaultValue if title not found
  @return int as entered by the user of the console app