code: public static String toHexString(byte[] bytes, boolean isHNF) {
      StringBuilder sb = new StringBuilder();
      for (byte b : bytes) {
        String hex =
            String.format("%2s", Integer.toHexString(b & 0xFF)).replace(' ', '0');
        if (isHNF)
          sb.append(hex);
        else
          sb.append(new StringBuilder(hex).reverse());
      }
      return sb.toString();
    }
docs: Converts a byte array to a hex String.
  
  @param bytes
  a byte array
  @param isHNF
  true if HNF(high nibble first), false if LNF(low nibble first)
  @return hex String