Convert a byte array to a hex encoded string. @param bytes the bytes to encode @return the hex encoded bytes
(byte[] bytes)
| 994 | * @return the hex encoded bytes |
| 995 | */ |
| 996 | public static String hex(byte[] bytes) { |
| 997 | StringBuilder sb = new StringBuilder(2 + bytes.length * 2); |
| 998 | sb.append('0'); |
| 999 | sb.append('x'); |
| 1000 | sb.append(BaseEncoding.base16().encode(bytes)); |
| 1001 | return sb.toString(); |
| 1002 | } |
| 1003 | |
| 1004 | // ---------------------- // |
| 1005 | // Comparing byte arrays. // |