private void shrinkArrays(int capacity) {
        int size = Math.max(capacity, 4);
        int[] newStarts = new int[size];
        short[] newLengths = new short[size];
        System.arraycopy(starts,0,newStarts,0,newStarts.length);
        System.arraycopy(lengths,0,newLengths,0,newStarts.length);
        starts = newStarts;
        lengths = newLengths;
    }
Shrinks the starts and lengths array as items at the end of the list
are removed.
@param capacity the new size to make the arrays
Ghidra/Framework/Generic/src/main/java/ghidra/util/datastruct/DoubleArrayArray.java