code: public String sign(String signatureBaseString) {
      if (privateKey == null) {
        throw new UnsupportedOperationException("Cannot sign the base string: no private key supplied.");
      }
  
      try {
        Signature signer = Signature.getInstance("SHA1withRSA");
        signer.initSign(privateKey);
        signer.update(signatureBaseString.getBytes("UTF-8"));
        byte[] signatureBytes = signer.sign();
        signatureBytes = Base64.encodeBase64(signatureBytes);
        return new String(signatureBytes, "UTF-8");
      }
      catch (NoSuchAlgorithmException e) {
        throw new IllegalStateException(e);
      }
      catch (InvalidKeyException e) {
        throw new IllegalStateException(e);
      }
      catch (SignatureException e) {
        throw new IllegalStateException(e);
      }
      catch (UnsupportedEncodingException e) {
        throw new RuntimeException(e);
      }
    }
docs: The Signature Base String is signed using the Consumer’s RSA private key per RFC3447 section 8.2.1, where K is the Consumer’s RSA private key,
  M the Signature Base String, and S is the result signature octet string:
  
  {@code S = RSASSA-PKCS1-V1_5-SIGN (K, M) }
  
  oauth_signature is set to S, first base64-encoded per RFC2045 section 6.8, then URL-encoded per Parameter Encoding.
  
  @param signatureBaseString The signature base string.
  @return The signature.
  @throws UnsupportedOperationException If there is no private key.