FastTailCharIterator { public char getNext(){ if(index == chars.length()) return '\0'; char ret = chars.charAt(index); if(ret <= '\1'){ if(ret == '\0'){ return ret; } else{ int i = chars.charAt(index + 1); i += chars.charAt(index + 2) << 16; index = i; ret = chars.charAt(index); } } index++; return ret; } FastTailCharIterator(CharSequence chars, int index); void setIndex(int index); char getNext();  }
@Test public void test_3() throws Exception{ String chars = "abc\1\6\0def\0"; FastTailCharIterator it = new FastTailCharIterator(chars, 0); Assert.assertEquals('a', it.getNext()); Assert.assertEquals('b', it.getNext()); Assert.assertEquals('c', it.getNext()); Assert.assertEquals('d', it.getNext()); Assert.assertEquals('e', it.getNext()); Assert.assertEquals('f', it.getNext()); Assert.assertEquals('\0', it.getNext()); }