static boolean allowDestinationRange(String prev, String next)
    {
        if (prev.isEmpty() || next.isEmpty())
        {
            return false;
        }
        int prevCode = prev.codePointAt(0);
        int nextCode = next.codePointAt(0);

        // Allow the new destination string if:
        // 1. It is sequential with the previous one and differs only in the low-order byte
        // 2. The previous string does not contain any UTF-16 surrogates
        return allowCodeRange(prevCode, nextCode) && prev.codePointCount(0, prev.length()) == 1;
    }
@Test
    void testAllowDestinationRangeSurrogates()
    {
        // Check surrogates
        StringBuilder endOfBMP = new StringBuilder();
        endOfBMP.appendCodePoint(0xFFFF);

        StringBuilder beyondBMP = new StringBuilder();
        beyondBMP.appendCodePoint(0x10000);

        StringBuilder cjk1 = new StringBuilder();
        cjk1.appendCodePoint(0x2F884);

        StringBuilder cjk2 = new StringBuilder();
        cjk2.appendCodePoint(0x2F885);

        StringBuilder cjk3 = new StringBuilder();
        cjk3.appendCodePoint(0x2F886);

        // Denied (overflow)
        assertFalse(
                ToUnicodeWriter.allowDestinationRange(endOfBMP.toString(), beyondBMP.toString()));
        // Allowed (sequential surrogates)
        assertTrue(ToUnicodeWriter.allowDestinationRange(cjk1.toString(), cjk2.toString()));
        assertTrue(ToUnicodeWriter.allowDestinationRange(cjk2.toString(), cjk3.toString()));
        // Denied (non sequential surrogates)
        assertFalse(ToUnicodeWriter.allowDestinationRange(cjk1.toString(), cjk3.toString()));
    }