code: private int getReturnParam() {
      // look for [retval] attribute
          for (int i = 0; i < params.length; i++) {
        if (params[i].isRetval()) {
          return i;
        }
      }
  
      // sometimes a COM method has only one [out] param.
      // treat that as the return value.
      // this is seen frequently in MSHTML (see IHTMLChangeLog, for example)
      int outIdx = -1;
      for (int i = 0; i < params.length; i++) {
        if (params[i].isOut() && !params[i].isIn()) {
          if (outIdx == -1) {
            outIdx = i;
          } else {
            return -1; // more than one out. no return value
          }
        }
      }
      return outIdx;
    }
docs: Returns the index of the return value parameter, or -1 if none.