public static String charToEscape(char ch) {
        String hexValue = Integer.toHexString(ch);
        if (hexValue.length() == 1) {
            return "\\u000" + hexValue;
        }
        if (hexValue.length() == 2) {
            return "\\u00" + hexValue;
        }
        if (hexValue.length() == 3) {
            return "\\u0" + hexValue;
        }
        return "\\u" + hexValue;
    }
public static String charToEscape ( char ch ) { String hexValue = Integer . toHexString ( ch ) ; if ( hexValue . length ( ) == 1 ) { return "\\u000" + hexValue ; } if ( hexValue . length ( ) == 2 ) { return "\\u00" + hexValue ; } if ( hexValue . length ( ) == 3 ) { return "\\u0" + hexValue ; } return "\\u" + hexValue ; }
Return the Java Unicode escape sequence for the given character. For example, the
null character (0x00) is converted to the string "\u0000". This method is useful
for creating display-friendly strings that contain hidden non-printable characters.

@param ch    Character to be converted.
@return      String containing the Java Unicode escape sequence for the given
character.