public static String encodeAsHexString(byte[] bytes) {
    StringBuilder hexString = new StringBuilder();
    for (byte b : bytes) {
      String hex = Integer.toHexString(0xff & b);
      if (hex.length() == 1) {
        hexString.append('0');
      }
      hexString.append(hex);
    }
    return hexString.toString();
  }
Encode binary as base 16 or hexadecimal characters
@param bytes bytes to be encoded
@return base 16 encoded string
ambry-utils/src/main/java/com/github/ambry/utils/Utils.java