List of utility methods to do Byte Array to Base16
String | bytesToBase16(byte[] bytes) Gera string em base 16 (tudo minusculo) dos bytes fornecidos. char[] hexChars = new char[bytes.length * 2]; for (int j = 0; j < bytes.length; j++) { int v = bytes[j] & 0xFF; hexChars[j * 2] = hexArray[v >>> 4]; hexChars[j * 2 + 1] = hexArray[v & 0x0F]; return new String(hexChars); |
String | byteToBase16(byte[] bytes) byte To Base if (bytes == null) { throw new IllegalArgumentException("The parameter should not be null!"); StringBuilder sb = new StringBuilder(bytes.length * 2); for (byte b : bytes) { sb.append(Integer.toHexString((b & 0xF0) >> 4)); sb.append(Integer.toHexString(b & 0x0F)); return sb.toString(); |