/** * Returns a hex string. * * @param bytes Bytes array. * @return Bytes in hex. */ public static String bytesToHexString(byte[] bytes) { checkNotNull(bytes, "Argument [bytes] may not be null"); StringBuilder buffer = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { buffer.append(UnsignedByte.toHexString(bytes[i])); if (i < bytes.length - 1) { buffer.append(" "); } } return buffer.toString(); }
/** * Returns a hex string. * * @param bytes Bytes array. * @return Bytes in hex. */ public static String bytesToHexString(byte[] bytes) { checkNotNull(bytes, "Argument [bytes] may not be null"); StringBuilder buffer = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { buffer.append(UnsignedByte.toHexString(bytes[i])); if (i < bytes.length - 1) { buffer.append(" "); } } return buffer.toString(); }