public long getAndUpdate(LongUnaryOperator updateFunction) {
        long prev, next;
        do {
            prev = lvVal();
            next = updateFunction.applyAsLong(prev);
        } while (!casVal(prev, next));
        return prev;
    }
@Test
    public void testGetAndUpdate() {
        PaddedAtomicLong counter = new PaddedAtomicLong();

        long value = counter.getAndUpdate(operand -> operand + 2);
        assertEquals(0, value);
        assertEquals(2, counter.get());
    }