### Question:
LdapStringSanitizer { public static String sanitize(final String input) { if(input == null) { return null; } final StringBuilder sb = new StringBuilder(); for (int i = 0; i < input.length(); i++) { final char c = input.charAt(i); if (c == '*') { sb.append("\\2a"); } else if (c == '(') { sb.append("\\28"); } else if (c == ')') { sb.append("\\29"); } else if (c == '\\') { sb.append("\\5c"); } else if (c == '\u0000') { sb.append("\\00"); } else if (c <= 0x7f) { sb.append(String.valueOf(c)); } else if (c >= 0x080) { final byte[] utf8bytes = String.valueOf(c).getBytes(StandardCharsets.UTF_8); for (final byte b : utf8bytes) { sb.append(String.format("\\%02x", b)); } } } return sb.toString(); } private  LdapStringSanitizer(); static String sanitize(final String input);  }### Answer:
@Test public void sanitizeTest() { Assert.assertEquals("abc\\2adef", LdapStringSanitizer.sanitize("abc*def")); Assert.assertEquals("abc\\28def", LdapStringSanitizer.sanitize("abc(def")); Assert.assertEquals("abc\\29def", LdapStringSanitizer.sanitize("abc)def")); Assert.assertEquals("abc\\5cdef", LdapStringSanitizer.sanitize("abc\\def")); Assert.assertEquals("abc\\00def", LdapStringSanitizer.sanitize("abc\u0000def")); Assert.assertEquals("abc\\c9\\86def", LdapStringSanitizer.sanitize("abc\u0246def")); }