code: public String usage(boolean showUnpublicized, String... groupNames) {
      if (!hasGroups) {
        if (groupNames.length > 0) {
          throw new IllegalArgumentException(
              "This instance of Options does not have any option groups defined");
        }
        return formatOptions(options, maxOptionLength(options, showUnpublicized), showUnpublicized);
      }
  
      List<OptionGroupInfo> groups = new ArrayList<>();
      if (groupNames.length > 0) {
        for (String groupName : groupNames) {
          if (!groupMap.containsKey(groupName)) {
            throw new IllegalArgumentException("invalid option group: " + groupName);
          }
          OptionGroupInfo gi = groupMap.get(groupName);
          if (!showUnpublicized && !gi.anyPublicized()) {
            throw new IllegalArgumentException(
                "group does not contain any publicized options: " + groupName);
          } else {
            groups.add(groupMap.get(groupName));
          }
        }
      } else { // return usage for all groups that are not unpublicized
        for (OptionGroupInfo gi : groupMap.values()) {
          if ((gi.unpublicized || !gi.anyPublicized()) && !showUnpublicized) {
            continue;
          }
          groups.add(gi);
        }
      }
  
      List<Integer> lengths = new ArrayList<>();
      for (OptionGroupInfo gi : groups) {
        lengths.add(maxOptionLength(gi.optionList, showUnpublicized));
      }
      int maxLength = Collections.max(lengths);
  
      StringJoiner buf = new StringJoiner(lineSeparator);
      for (OptionGroupInfo gi : groups) {
        buf.add(String.format("%n%s:", gi.name));
        buf.add(formatOptions(gi.optionList, maxLength, showUnpublicized));
      }
  
      return buf.toString();
    }
docs: Returns a usage message for command-line options.
  
  @return the command-line usage message
  @param showUnpublicized if true, treat all unpublicized options and option groups as publicized
  @param groupNames the list of option groups to include in the usage message. If empty and
  option groups are being used, will return usage for all option groups that are not
  unpublicized. If empty and option groups are not being used, will return usage for all
  options that are not unpublicized.