ValueXmlHelper { @VisibleForTesting static boolean isEscaped(String s, int index) { if (index == 0 || index == s.length()) { return false; } int prevPos = index - 1; char prev = s.charAt(prevPos); if (prev != '\\') { return false; } int j = prevPos - 1; while (j >= 0) { if (s.charAt(j) != '\\') { break; } j--; } return (prevPos - j) % 2 == 1; }  @SuppressWarnings("UnnecessaryContinue") @Nullable static String unescapeResourceString(
            @Nullable String s,
            boolean escapeEntities, boolean trim); @NonNull static String escapeResourceString(@NonNull String string); @NonNull static String escapeResourceString(@NonNull String string,
            boolean escapeMarkupDelimiters); @NonNull static String escapeResourceStringAsXml(@NonNull String xml);  }
@Test @SuppressWarnings("NonBooleanMethodNameMayNotStartWithQuestion") public void isEscaped() { assertFalse(ValueXmlHelper.isEscaped("", 0)); assertFalse(ValueXmlHelper.isEscaped(" ", 0)); assertFalse(ValueXmlHelper.isEscaped(" ", 1)); assertFalse(ValueXmlHelper.isEscaped("x\\y ", 0)); assertFalse(ValueXmlHelper.isEscaped("x\\y ", 1)); assertTrue(ValueXmlHelper.isEscaped("x\\y ", 2)); assertFalse(ValueXmlHelper.isEscaped("x\\y ", 3)); assertFalse(ValueXmlHelper.isEscaped("x\\\\y ", 0)); assertFalse(ValueXmlHelper.isEscaped("x\\\\y ", 1)); assertTrue(ValueXmlHelper.isEscaped("x\\\\y ", 2)); assertFalse(ValueXmlHelper.isEscaped("x\\\\y ", 3)); assertFalse(ValueXmlHelper.isEscaped("\\\\\\\\y ", 0)); assertTrue(ValueXmlHelper.isEscaped("\\\\\\\\y ", 1)); assertFalse(ValueXmlHelper.isEscaped("\\\\\\\\y ", 2)); assertTrue(ValueXmlHelper.isEscaped("\\\\\\\\y ", 3)); assertFalse(ValueXmlHelper.isEscaped("\\\\\\\\y ", 4)); }