private List<String> breakupString(final String str, final int maxLength) {
    final List<String> result = new ArrayList<>();
    int startIdx = -1;
    int lastIdx;
    int idx;

    if (str == null) {
      return result;
    }

    do {
      idx = startIdx;
      do {
        lastIdx = idx;
        idx = str.indexOf(' ', lastIdx + 1);
        LOG.fine("startIdx=" + startIdx + "  lastIdx=" + lastIdx + "  idx=" + idx);
        if (idx < 0) {
          // Canot break line up any further
          result.add(str.substring(startIdx + 1));
          return result;
        }
      } while ((idx - startIdx) <= maxLength);

      result.add(str.substring(startIdx + 1, lastIdx));
      startIdx = lastIdx;
    } while (true);
  }
Breaks up a string into sub-strings, each with a length equal to or less than the max length
specified.

@param str string to break up
@param maxLength maximum line length to use
@return broken up string
extensions/geode-modules-session/src/main/java/org/apache/geode/modules/session/installer/args/ArgumentProcessor.java