字符串16进制打印

String name = "中文";
byte[] gbkbytes = name.getBytes("ISO-8859-1");
for (int i = 0; i < gbkbytes.length; i ++) {
System.out.printf("0x%02X ", gbkbytes[i]);
}
System.out.println();

你可能感兴趣的:(字符串16进制打印)