public static void printBytes(byte[] b) {
System.out.println("\nBytes:===========");
for (int i = 0; i < b.length; i++) {
System.out.print(Integer.toHexString(b[i]) + " ");
}
}
System.out.println("\nBytes:===========");
for (int i = 0; i < b.length; i++) {
System.out.print(Integer.toHexString(b[i]) + " ");
}
}
------------------------------------------------------------------------------
public static String showBytes(byte[] bytes) {
char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F' };
char[] chars = new char[bytes.length * 2];
for (int i = 0; i < bytes.length; i++) {
int b = bytes[i];
chars[i * 2] = hexDigits[(b >>> 4) & 0x0F];
chars[i * 2 + 1] = hexDigits[b & 0x0F];
}
return new String(chars);
}
--------------------------------------------------------------------------
byte[] d=new String(c+"").getBytes("GBK");