code: public void printUsage (@Nonnull final PrintWriter aPW,
                            final int nWidth,
                            final String sAppName,
                            final Options aOptions)
    {
      // initialise the string buffer
      final StringBuilder aSB = new StringBuilder (getSyntaxPrefix ()).append (sAppName).append (' ');
  
      // create a list for processed option groups
      final ICommonsSet <OptionGroup> aProcessedGroups = new CommonsHashSet <> ();
  
      final ICommonsList <Option> aOptList = aOptions.getAllResolvedOptions ();
      if (m_aOptionComparator != null)
        aOptList.sort (m_aOptionComparator);
  
      // iterate over the options
      for (final Iterator <Option> aIt = aOptList.iterator (); aIt.hasNext ();)
      {
        // get the next Option
        final Option aOption = aIt.next ();
  
        // check if the option is part of an OptionGroup
        final OptionGroup group = aOptions.getOptionGroup (aOption);
  
        // if the option is part of a group
        if (group != null)
        {
          // and if the group has not already been processed
          if (aProcessedGroups.add (group))
          {
            // add the usage clause
            _appendOptionGroup (aSB, group);
          }
  
          // otherwise the option was displayed in the group
          // previously so ignore it.
        }
        else
        {
          // if the Option is not part of an OptionGroup
          _appendOption (aSB, aOption, aOption.isRequired ());
        }
  
        if (aIt.hasNext ())
          aSB.append (' ');
      }
  
      // call printWrapped
      printWrapped (aPW, nWidth, aSB.toString ().indexOf (' ') + 1, aSB.toString ());
    }
docs: Prints the usage statement for the specified application.
  
  @param aPW
  The PrintWriter to print the usage statement
  @param nWidth
  The number of characters to display per line
  @param sAppName
  The application name
  @param aOptions
  The command line Options