@Test public void toHexString() { assertEquals("", BitUtil.toHexString(null)); assertEquals("00", BitUtil.toHexString(new byte[] { 0 })); assertEquals("FFFFFFFF", BitUtil.toHexString(new byte[] { (byte) 0xff, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF })); }
public static String toHexString(byte[] array) { if (array == null) { return ""; } StringBuilder sb = new StringBuilder(array.length * 2); for (byte byt : array) { int v = byt & 0xff; if (v < 16) { sb.append('0'); } sb.append(Integer.toHexString(v)); } return sb.toString().toUpperCase(); }
BitUtil { public static String toHexString(byte[] array) { if (array == null) { return ""; } StringBuilder sb = new StringBuilder(array.length * 2); for (byte byt : array) { int v = byt & 0xff; if (v < 16) { sb.append('0'); } sb.append(Integer.toHexString(v)); } return sb.toString().toUpperCase(); } }
BitUtil { public static String toHexString(byte[] array) { if (array == null) { return ""; } StringBuilder sb = new StringBuilder(array.length * 2); for (byte byt : array) { int v = byt & 0xff; if (v < 16) { sb.append('0'); } sb.append(Integer.toHexString(v)); } return sb.toString().toUpperCase(); } private  BitUtil(); }
BitUtil { public static String toHexString(byte[] array) { if (array == null) { return ""; } StringBuilder sb = new StringBuilder(array.length * 2); for (byte byt : array) { int v = byt & 0xff; if (v < 16) { sb.append('0'); } sb.append(Integer.toHexString(v)); } return sb.toString().toUpperCase(); } private  BitUtil(); static String toHexString(byte[] array); }
BitUtil { public static String toHexString(byte[] array) { if (array == null) { return ""; } StringBuilder sb = new StringBuilder(array.length * 2); for (byte byt : array) { int v = byt & 0xff; if (v < 16) { sb.append('0'); } sb.append(Integer.toHexString(v)); } return sb.toString().toUpperCase(); } private  BitUtil(); static String toHexString(byte[] array);  }