code: private static byte[] hmacSha(String crypto, byte[] keyBytes, byte[] text) {
          try {
              Mac hmac;
              hmac = Mac.getInstance(crypto);
              SecretKeySpec macKey = new SecretKeySpec(keyBytes, "RAW");
              hmac.init(macKey);
              return hmac.doFinal(text);
          } catch (GeneralSecurityException gse) {
              throw new UndeclaredThrowableException(gse);
          }
      }
docs: This method uses the JCE to provide the crypto algorithm. HMAC computes a
  Hashed Message Authentication Code with the crypto hash algorithm as a
  parameter.
  
  @param crypto
  : the crypto algorithm (HmacSHA1, HmacSHA256, HmacSHA512)
  @param keyBytes
  : the bytes to use for the HMAC key
  @param text
  : the message or text to be authenticated