### Question:
UnicodeMap { public static String string2TeX(String in) { int[] chars = in.codePoints().toArray(); StringBuilder res = new StringBuilder(); for (int code : chars) { res.append(char2TeX(code)); } String s = res.toString().trim(); if (chars.length == 1) { s = s.replaceAll("^\\{(.*)\\}$", "$1"); } return s; }  static String string2TeX(String in); static String char2TeX(int codePoint);  }### Answer:
@Test public void testString2TeX() throws Exception { String teX = UnicodeMap.string2TeX("Ĥψ=Eψ"); assertEquals("\\hat{H}{\\psi}=E{\\psi}", teX); }