### Question:
CreateUidsIterator implements SortedKeyValueIterator<Key,Value>, OptionDescriber { public static int lastNull(ByteSequence bs) { int pos = bs.length(); while (--pos > 0 && bs.byteAt(pos) != 0x00) ; return pos; }  @Override void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env); @Override boolean hasTop(); @Override void next(); @Override void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive); @Override Key getTopKey(); @Override Value getTopValue(); @Override SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env); IndexInfo getValue(); static boolean sameShard(Key ref, Key test); static Tuple3<Long,Boolean,List<String>> parseUids(Key k, Value v); static String parseDataType(Key k); static int lastNull(ByteSequence bs); static Key makeRootKey(Key k); @Override IteratorOptions describeOptions(); @Override boolean validateOptions(Map<String,String> options); static final String COLLAPSE_UIDS; static final String PARSE_TLD_UIDS; }### Answer:
@Test public void testLastNull() { ArrayByteSequence bs = new ArrayByteSequence("shard_1\u0000datatype".getBytes(Charset.forName("UTF-8"))); assertEquals("shard_1".length(), CreateUidsIterator.lastNull(bs)); }