code: public static int findNumberOption(String[] args, String option) {
          int rc = 0;
          for (int i = 0; i<args.length; ++i) {
              if (args[i].equals(option)) {
                  if (args.length > i+1) {
                      rc = Integer.parseInt(args[i+1]);
                  }
              }
          }
          return rc;
      }
docs: Scan the arguments to find an option that specifies a number.