static byte[] getShortStringLengthInBytes(CharSequence str) throws Exception
    {
        byte[] array = str.toString().getBytes("UTF-8");
        return new byte[] { (byte) ((array.length >> 8) & 0xff), (byte) (array.length & 0xff) };
    }
Tests for UTF-8 Encoding

@author David Yu
@created Jul 6, 2010
protostuff-api/src/test/java/io/protostuff/StringSerializerTest.java