code: private static Object findValue(final OptionElement subroot,
                                    final String[] pathElements, int pos) {
      if (pos >= 0) {
        // Not at root.
        if (!pathElements[pos].equals(subroot.name)) {
          return null;
        }
      }
  
      if (subroot.isValue) {
        // pos must be last entry
        if ((pos + 1) != pathElements.length) {
          return null;
        }
        return subroot.val;
      }
  
      pos++;
      if (pos == pathElements.length) {
        return null;
      }
  
      /* look to children for some value */
  
      Object singleRes = null;
      ArrayList<Object> multiRes = null;
  
      for (OptionElement optel: subroot.getChildren()) {
        Object res = findValue(optel, pathElements, pos);
        if (res != null) {
          if (singleRes != null) {
            multiRes = new ArrayList<Object>();
            appendResult(singleRes, multiRes);
            singleRes = null;
            appendResult(res, multiRes);
          } else if (multiRes != null) {
            appendResult(res, multiRes);
          } else {
            singleRes = res;
          }
        }
      }
  
      if (multiRes != null) {
        return multiRes;
      }
  
      return singleRes;
    }
docs: /* Given the root and a path element array find the corresponding value(s)