Here you can find the source of toJavaHexCharString(final char chr)
private static String toJavaHexCharString(final char chr)
//package com.java2s; public class Main { private static String toJavaHexCharString(final char chr) { final String hexString = "0000" + Integer.toHexString(chr); return "\\u" + hexString.substring(hexString.length() - 4); }//from ww w .j av a 2s .c o m }