public class Test { public static void main(String[] args) { String str = "你好!"; String unicode = ""; char[] charAry = new char[str.length()]; for (int i = 0; i < charAry.length; i++) { charAry[i] = (char) str.charAt(i); unicode += "\\u" + Integer.toHexString(charAry[i]); } System.out.println(unicode); } }?