public long accumulateAndGet(long x, LongBinaryOperator f) {
        long prev, next;
        do {
            prev = lvVal();
            next = f.applyAsLong(prev, x);
        } while (!casVal(prev, next));
        return next;
    }
@Test
    public void testAccumulateAndGet() {
        PaddedAtomicLong counter = new PaddedAtomicLong(10);

        long value = counter.accumulateAndGet(1, (left, right) -> left+right);

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