Here you can find the source of toHexString(byte[] data)
Parameter | Description |
---|---|
data | The array of bytes to be converted. |
public static String toHexString(byte[] data)
//package com.java2s; public class Main { /**/*w ww . ja v a 2 s . c om*/ * Converts a byte array into a String of its hexadecimal representation. * This method should be called statically. * @param data The array of bytes to be converted. * @return The hexadecimal String representation of the byte array. */ public static String toHexString(byte[] data) { int c; String res = "", s; for (byte aux : data) { c = aux & 0xff; s = Integer.toHexString(c); if (s.length() == 1) res += "0"; res += s; } return res; } }