protected Long[] getXRefRanges(List<XReferenceEntry> xRefEntriesList) {
        long last = -2;
        long count = 1;

        List<Long> list = new ArrayList<>();
        for (XReferenceEntry object : xRefEntriesList) {
            long nr = (int) object.getReferencedKey().getNumber();
            if (nr == last + 1) {
                ++count;
                last = nr;
            } else if (last == -2) {
                last = nr;
            } else {
                list.add(last - count + 1);
                list.add(count);
                last = nr;
                count = 1;
            }
        }
        // If no new entry is found, we need to write out the last result
        if (xRefEntriesList.size() > 0) {
            list.add(last - count + 1);
            list.add(count);
        }
        return list.toArray(new Long[0]);
    }
check the xref entries and write out the ranges.  The format of the
returned array is exactly the same as the pdf specification.  See section
7.5.4 of ISO32000-1:2008, example 1 (page 40) for reference.
<p>
example: 0 1 2 5 6 7 8 10
<p>
will create a array with follow ranges
<p>
0 3 5 4 10 1
<p>
this mean that the element 0 is followed by two other related numbers
that represent a cluster of the size 3. 5 is follow by three other
related numbers and create a cluster of size 4. etc.

@param xRefEntriesList list with the xRef entries that was written
@return a integer array with the ranges
tika-fuzzing/src/main/java/org/apache/tika/fuzzing/pdf/EvilCOSWriter.java