code: String generateAuthorizationHeader(String method, String url, HttpParameter[] params, String nonce, String timestamp, OAuthToken otoken) {
          if (null == params) {
              params = new HttpParameter[0];
          }
          List<HttpParameter> oauthHeaderParams = new ArrayList<HttpParameter>(5);
          oauthHeaderParams.add(new HttpParameter("oauth_consumer_key", consumerKey));
          oauthHeaderParams.add(OAUTH_SIGNATURE_METHOD);
          oauthHeaderParams.add(new HttpParameter("oauth_timestamp", timestamp));
          oauthHeaderParams.add(new HttpParameter("oauth_nonce", nonce));
          oauthHeaderParams.add(new HttpParameter("oauth_version", "1.0"));
          if (otoken != null) {
              oauthHeaderParams.add(new HttpParameter("oauth_token", otoken.getToken()));
          }
          List<HttpParameter> signatureBaseParams = new ArrayList<HttpParameter>(oauthHeaderParams.size() + params.length);
          signatureBaseParams.addAll(oauthHeaderParams);
          if (!HttpParameter.containsFile(params)) {
              signatureBaseParams.addAll(toParamList(params));
          }
          parseGetParameters(url, signatureBaseParams);
          StringBuilder base = new StringBuilder(method).append("&")
                  .append(HttpParameter.encode(constructRequestURL(url))).append("&");
          base.append(HttpParameter.encode(normalizeRequestParameters(signatureBaseParams)));
          String oauthBaseString = base.toString();
          logger.debug("OAuth base string: ", oauthBaseString);
          String signature = generateSignature(oauthBaseString, otoken);
          logger.debug("OAuth signature: ", signature);
  
          oauthHeaderParams.add(new HttpParameter("oauth_signature", signature));
  
          // http://oauth.net/core/1.0/#rfc.section.9.1.1
          if (realm != null) {
              oauthHeaderParams.add(new HttpParameter("realm", realm));
          }
          return "OAuth " + encodeParameters(oauthHeaderParams, ",", true);
      }
docs: /*package