ByteArrayCharSequence implements CharSequence { @Override public String toString() { return CharSequences.toString(this); } ByteArrayCharSequence(byte[] bytes, int start, int end); @Override int length(); @Override char charAt(int index); @Override ByteArrayCharSequence subSequence(int start, int end); @Override String toString(); static byte[] toSingleByteUtf8Encoding(CharSequence charSequence);  }
@Test public void testToString() throws Exception { byte[] bytes = "FOOBAR".getBytes("UTF-8"); ByteArrayCharSequence bacs = new ByteArrayCharSequence(bytes, 0, bytes.length); assertEquals("FOOBAR", bacs.toString()); }