writer.add(1);
writer.add(2);
writer.finish();
output.close();
IndexInput input = dir.openInput("foo", IOContext.DEFAULT);
NumericDocValues reader = DirectReader.getInstance(input.randomAccessSlice(0, input.length()), bitsPerValue);
assertEquals(1, reader.get(0));
assertEquals(0, reader.get(1));
assertEquals(2, reader.get(2));
assertEquals(1, reader.get(3));
assertEquals(2, reader.get(4));