public long getAndAccumulate(long v, LongBinaryOperator f) {
        long prev, next;
        do {
            prev = lvVal();
            next = f.applyAsLong(prev, v);
        } while (!casVal(prev, next));
        return prev;
    }
@Test
    public void testGetAndAccumulate() {
        PaddedAtomicLong counter = new PaddedAtomicLong(10);
        
        long value = counter.getAndAccumulate(1, (left, right) -> left+right);

        assertEquals(value, 10);
        assertEquals(11, counter.get());
    }