### Question:
Utf8 { @SuppressWarnings({ "squid:S135" }) public static int encode(final byte[] da, final char[] sa, final int from, final int to) { int dp = 0; char c; char d; int uc; int pos = from; while (pos < to) { c = sa[pos++]; if (c < 0x80) { da[dp++] = (byte) c; continue; } if (c < 0x800) { da[dp++] = (byte) (0xc0 | (c >> 6)); da[dp++] = (byte) (0x80 | (c & 0x3f)); continue; } if (c >>> 11 != 0x1B) { da[dp++] = (byte) (0xe0 | (c >> 12)); da[dp++] = (byte) (0x80 | ((c >> 6) & 0x3f)); da[dp++] = (byte) (0x80 | (c & 0x3f)); continue; } if (c <= Character.MAX_HIGH_SURROGATE && pos < to) { d = sa[pos++]; if (d >>> 10 == 0x37) { uc = Character.toCodePoint(c, d); da[dp++] = (byte) (0xf0 | (uc >> 18)); da[dp++] = (byte) (0x80 | ((uc >> 12) & 0x3f)); da[dp++] = (byte) (0x80 | ((uc >> 6) & 0x3f)); da[dp++] = (byte) (0x80 | (uc & 0x3f)); continue; } --pos; } da[dp++] = '?'; } return dp; }  @SuppressWarnings({ "squid:S3776", // Cognitive Complexity of methods should not be too high "squid:S135" // Loops should not contain more than a single "break" or "continue" statement }) static int decode(final byte[] sa, final int from, final int len, final char[] da); @SuppressWarnings({ "squid:S135" // Loops should not contain more than a single "break" or "continue" statement }) static int encode(final byte[] da, final char[] sa, final int from, final int to); static final int MAX_BYTES_PER_CHAR; }### Answer:
@Test void testEncode() { assertTrue(matchEncode("")); assertTrue(matchEncode("1234567890Az")); assertTrue(matchEncode("中文")); assertTrue(matchEncode("┯┰┱╂╁┾")); assertTrue(matchEncode("ⅠⅡⅢⅣ㈣㈢⒈⒐⑽")); assertTrue(matchEncode("\u0080\u00CA\u01CA\u07FF")); assertTrue(matchEncode("\uD856\uDC65\uD866\uDC66")); assertTrue(matchEncode("\uD700\uE000")); }