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

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