public static String bytesToHex(byte[] bytes, int groupSize) { if (bytes == null) { return "NULL"; } if (bytes.length == 0) { return "[]"; } char[] hexChars = new char[bytes.length * 2 + numberOfGroups(bytes, groupSize)]; int outPos = 0; for (int j = 0; j < bytes.length; j++) { if (j > 0 && j % groupSize == 0) { hexChars[outPos++] = ' '; } int v = bytes[j] & 0xFF; hexChars[outPos++] = hexArray[v >>> 4]; hexChars[outPos++] = hexArray[v & 0x0F]; } return new String(hexChars); }
public static String bytesToHex(byte[] bytes, int groupSize) { if (bytes == null) { return "NULL"; } if (bytes.length == 0) { return "[]"; } char[] hexChars = new char[bytes.length * 2 + numberOfGroups(bytes, groupSize)]; int outPos = 0; for (int j = 0; j < bytes.length; j++) { if (j > 0 && j % groupSize == 0) { hexChars[outPos++] = ' '; } int v = bytes[j] & 0xFF; hexChars[outPos++] = hexArray[v >>> 4]; hexChars[outPos++] = hexArray[v & 0x0F]; } return new String(hexChars); }
public static String bytesToHex(byte[] bytes, int groupSize) { if (bytes == null) { return "NULL"; } if (bytes.length == 0) { return "[]"; } char[] hexChars = new char[bytes.length * 2 + numberOfGroups(bytes, groupSize)]; int outPos = 0; for (int j = 0; j < bytes.length; j++) { if (j > 0 && j % groupSize == 0) { hexChars[outPos++] = ' '; } int v = bytes[j] & 0xFF; hexChars[outPos++] = hexArray[v >>> 4]; hexChars[outPos++] = hexArray[v & 0x0F]; } return new String(hexChars); }
public static String bytesToHex(byte[] bytes, int groupSize) { if (bytes == null) { return "NULL"; } if (bytes.length == 0) { return "[]"; } char[] hexChars = new char[bytes.length * 2 + numberOfGroups(bytes, groupSize)]; int outPos = 0; for (int j = 0; j < bytes.length; j++) { if (j > 0 && j % groupSize == 0) { hexChars[outPos++] = ' '; } int v = bytes[j] & 0xFF; hexChars[outPos++] = hexArray[v >>> 4]; hexChars[outPos++] = hexArray[v & 0x0F]; } return new String(hexChars); }
public static String bytesToHex(byte[] bytes, int groupSize) { if (bytes == null) { return "NULL"; } if (bytes.length == 0) { return "[]"; } char[] hexChars = new char[bytes.length * 2 + numberOfGroups(bytes, groupSize)]; int outPos = 0; for (int j = 0; j < bytes.length; j++) { if (j > 0 && j % groupSize == 0) { hexChars[outPos++] = ' '; } int v = bytes[j] & 0xFF; hexChars[outPos++] = hexArray[v >>> 4]; hexChars[outPos++] = hexArray[v & 0x0F]; } return new String(hexChars); }
public static String bytesToHex(byte[] bytes, int groupSize) { if (bytes == null) { return "NULL"; } if (bytes.length == 0) { return "[]"; } char[] hexChars = new char[bytes.length * 2 + numberOfGroups(bytes, groupSize)]; int outPos = 0; for (int j = 0; j < bytes.length; j++) { if (j > 0 && j % groupSize == 0) { hexChars[outPos++] = ' '; } int v = bytes[j] & 0xFF; hexChars[outPos++] = hexArray[v >>> 4]; hexChars[outPos++] = hexArray[v & 0x0F]; } return new String(hexChars); }
public static String bytesToHex(byte[] bytes, int groupSize) { if (bytes == null) { return "NULL"; } if (bytes.length == 0) { return "[]"; } char[] hexChars = new char[bytes.length * 2 + numberOfGroups(bytes, groupSize)]; int outPos = 0; for (int j = 0; j < bytes.length; j++) { if (j > 0 && j % groupSize == 0) { hexChars[outPos++] = ' '; } int v = bytes[j] & 0xFF; hexChars[outPos++] = hexArray[v >>> 4]; hexChars[outPos++] = hexArray[v & 0x0F]; } return new String(hexChars); }