Here you can find the source of toUnicodeValue(char c)
public static String toUnicodeValue(char c)
//package com.java2s; /** This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. *//* w w w.j a v a 2 s. c o m*/ public class Main { public static String toUnicodeValue(char c) { String s = Integer.toHexString(c); int length = s.length(); for (int i = 1; i < 5 - length; i++) { s = "0" + s; } return "\\u" + s.toUpperCase(); } }