question: public static String quote ( char ch ) { switch ( ch ) { case '\b' : return "\\b" ; case '\f' : return "\\f" ; case '\n' : return "\\n" ; case '\r' : return "\\r" ; case '\t' : return "\\t" ; case '\'' : return "\\'" ; case '\"' : return "\\\"" ; case '\\' : return "\\\\" ; default : return ( isPrintableAscii ( ch ) ) ? String . valueOf ( ch ) : String . format ( "\\u%04x" , ( int ) ch ) ; } }
target:  Escapes a character if it has an escape sequence or is non-printable ASCII.  Leaves non-ASCII characters alone.