Here you can find the source of unicodeEscape(char c)
private static String unicodeEscape(char c)
//package com.java2s; public class Main { private static String unicodeEscape(char c) { if (c <= 0xf) return "\\u000" + Integer.toHexString(c); else if (c <= 0xff) return "\\u00" + Integer.toHexString(c); else if (c <= 0xfff) return "\\u0" + Integer.toHexString(c); else/* www . j a v a 2s .c om*/ return "\\u" + Integer.toHexString(c); } }