Here you can find the source of toUnicodeString(String str)
public static String toUnicodeString(String str)
//package com.java2s; public class Main { public static String toUnicodeString(String str) { String unicode = ""; char[] charAry = new char[str.length()]; for (int i = 0; i < charAry.length; ++i) { charAry[i] = str.charAt(i);// www. ja v a2 s. c o m unicode = unicode + "\\u" + Integer.toString(charAry[i], 16); } return unicode; } }