public class code{ public static void main(string[] args) { string temp = " "; try { // utf-8 byte[] bytes = temp.getbytes("utf-8"); for (byte b : bytes) { system.out.println(integer.tohexstring(b)); } // (gbk) system.out.println("java " + charset.defaultcharset().displayname()); // unicode byte[] bytes2 = temp.getbytes("utf-16be"); string unicode = ""; for (int i = 0; i < bytes2.length; i++) { unicode += integer.tohexstring(bytes2[i]); } system.out.println("unicode " +unicode ); //unicode int shui = integer.parseint("6c49", 16); char i = (char)shui; system.out.println(i); } catch (unsupportedencodingexception e) { // todo auto-generated catch block e.printstacktrace(); } }}