AtomicPositiveInteger extends Number { public final int getAndDecrement() { return indexUpdater.getAndDecrement(this) & Integer.MAX_VALUE; } AtomicPositiveInteger();  AtomicPositiveInteger(int initialValue); final int getAndIncrement(); final int getAndDecrement(); final int incrementAndGet(); final int decrementAndGet(); final int get(); final void set(int newValue); final int getAndSet(int newValue); final int getAndAdd(int delta); final int addAndGet(int delta); final boolean compareAndSet(int expect, int update); final boolean weakCompareAndSet(int expect, int update); @Override byte byteValue(); @Override short shortValue(); @Override int intValue(); @Override long longValue(); @Override float floatValue(); @Override double doubleValue(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testGetAndDecrement() throws Exception { int get = i1.getAndDecrement(); assertEquals(0, get); assertEquals(Integer.MAX_VALUE, i1.get()); get = i2.getAndDecrement(); assertEquals(127, get); assertEquals(126, i2.get()); get = i3.getAndDecrement(); assertEquals(Integer.MAX_VALUE, get); assertEquals(Integer.MAX_VALUE - 1, i3.get()); }