public void increment(long index, long increment) {
        long whichByte = index >>> 3;
        int whichBit = (int) (index & 0x07);

        int whichSegment = (int) (whichByte >>> log2OfSegmentSizeInBytes);

        long[] segment = segments[whichSegment];
        long elementByteOffset = (long) Unsafe.ARRAY_LONG_BASE_OFFSET + (whichByte & byteBitmask);
        long l = unsafe.getLong(segment, elementByteOffset);

        unsafe.putLong(segment, elementByteOffset, l + (increment << whichBit));

        /// update the fencepost longs
        if((whichByte & byteBitmask) > bitmask * 8 && (whichSegment + 1) < segments.length) {
            unsafe.putLong(segments[whichSegment + 1], (long) Unsafe.ARRAY_LONG_BASE_OFFSET, segments[whichSegment][bitmask + 1]);
        }
        if((whichByte & byteBitmask) < 8 && whichSegment > 0) {
            unsafe.putLong(segments[whichSegment - 1], (long) Unsafe.ARRAY_LONG_BASE_OFFSET + (8 * (bitmask + 1)), segments[whichSegment][0]);
        }
    }
@Test
    public void testIncrement() {
        FixedLengthElementArray arr = new FixedLengthElementArray(WastefulRecycler.SMALL_ARRAY_RECYCLER, 1000000);

        Random rand = new Random();

        long startVal = rand.nextInt(Integer.MAX_VALUE);
        int elementCount = 0;

        for(int i=0;i<1000000;i+=65) {
            arr.setElementValue(i, 60, startVal+i);
            elementCount++;
        }

        arr.incrementMany(0, 1000, 65, elementCount);

        for(int i=0;i<1000000;i+=65) {
            long val = arr.getElementValue(i, 60);
            Assert.assertEquals(startVal + i + 1000, val);
        }

        arr.incrementMany(0, -2000, 65, elementCount);

        for(int i=0;i<1000000;i+=65) {
            long val = arr.getElementValue(i, 60);
            Assert.assertEquals(startVal + i - 1000, val);
        }

    }