code: public static byte[] encodeHex(final byte[] data) {
      if (data == null)
        throw new NullPointerException("Parameter 'data' cannot be null.");
  
      final char[] toDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
      final int l = data.length;
      final char[] out = new char[l << 1];
      for (int i = 0, j = 0; i < l; i++) {
        out[j++] = toDigits[(0xF0 & data[i]) >>> 4];
        out[j++] = toDigits[0x0F & data[i]];
      }
  
      return new String(out).getBytes(StandardCharsets.UTF_8);
    }
docs: Encodes a hex {@code byte[]} from given {@code byte[]}.
  
  This function is equivalent to Apache commons-codec binary {@code new Hex().encode(byte[])}
  
  @param data
  The data to encode as hex.
  @return Hex-encoded {@code byte[]}
  @throws NullPointerException
  If {@code data} is {@code null}.