OffsetList list = new OffsetList();
for (int i = 0; i < offsets.length; i += 1) {
list.add(offsets[i], true);
}
long[] array = list.toArray();
assertTrue("array=\n" + dump(array) + " offsets=\n" + dump(offsets),
Arrays.equals(offsets, array));
long[] sorted = new long[array.length];
System.arraycopy(array, 0, sorted, 0, array.length);