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();