@Test
    public void encodeStartEndPositionsMultibyteCharsAtEnd() {
        String foo = "\u0200abcde\uD800\uDC00";
        int start = 0;
        int length = foo.length(); //8
        int end = start + length;

        int[] indexes = calculateBytePositions(foo);
        int byteStart = indexes[start];
        int byteEnd = indexes[end];
        int byteLength = byteEnd - byteStart;

        //utf-8
        //0xC880 a b c d e 0xD800DC00

        assertThat(byteStart, equalTo(start));
        assertThat(byteEnd, equalTo(11));
        assertThat(byteLength, equalTo(11));
    }
@author <a href="mailto:borud@yahoo-inc.com">Bjorn Borud</a>
@author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a>
vespajlib/src/test/java/com/yahoo/text/Utf8TestCase.java