private List<Match> checkMatches(final String[] programArgs, final ArgumentValues values)
      throws UsageException {
    final List<Match> result = new ArrayList<>();
    Match match;
    String[] params;
    String[] postArgs;
    int idx = 0;
    int idx2;

    while (idx < programArgs.length) {
      // Check for end-of-parameters arg
      if ("--".equals(programArgs[idx])) {
        if (++idx < programArgs.length) {
          postArgs = new String[programArgs.length - idx];
          System.arraycopy(programArgs, idx, postArgs, 0, postArgs.length);
          values.setPostArgs(postArgs);
        }
        // We're done processing args'
        break;
      }

      // Determine parameter count
      idx2 = idx;
      while ((idx2 + 1) < programArgs.length && programArgs[idx2 + 1].charAt(0) != '-') {
        idx2++;
      }

      // Generate parameter array
      params = new String[idx2 - idx];
      System.arraycopy(programArgs, idx + 1, params, 0, params.length);

      LOG.fine("Arg: " + programArgs[idx]);
      LOG.fine("Params: " + params.length);

      // Find first argument matches
      match = null;
      for (Argument arg : args) {
        match = checkMatch(programArgs[idx], arg, params);
        if (match != null) {
          result.add(match);
          LOG.fine("Match found: ");
          LOG.fine("     ID: " + arg);
          LOG.fine("   Form: " + match.getForm());
          break;
        }
      }
      if (match == null) {
        if (handler == null) {
          final UsageException usageException = new UsageException(
              "Unknown argument: " + programArgs[idx] + " with " + params.length + " parameters.");
          usageException.setUsage(getUsage());
          throw (usageException);
        } else {
          handler.handleUnknownArgument(programArgs[idx], params);
        }
      }

      idx += params.length + 1;
    }

    return result;
  }
Builds a listof all argument matches and sets the postArgs array.

@param programArgs command line arguments to search through
@param values values object in which to store results
@return list of matches
@throws UsageException when there is EBKAC
extensions/geode-modules-session/src/main/java/org/apache/geode/modules/session/installer/args/ArgumentProcessor.java