### Question:
Counter extends ValueType<UnsignedLong> { @Override public ValueType<UnsignedLong> delta(Number value) { UnsignedLong previous = toUnsignedLong(value); if (previous.compareTo(getValue()) > 0) { if (NAN_ON_COUNTER_WRAP) { throw new ArithmeticException(); } UnsignedLong count32 = getValue().plus(MAX32).plus(UnsignedLong.ONE); if (previous.compareTo(count32) > 0) { return new Counter(MAX64.minus(previous).plus(getValue()).plus(UnsignedLong.ONE)); } else { return new Counter(MAX32.minus(previous).plus(getValue())).plus(UnsignedLong.ONE); } } else { return new Counter(getValue().minus(previous)); } } Counter(long value);  Counter(UnsignedLong value); @Override Counter plus(Number value); @Override Counter minus(Number value); @Override ValueType<UnsignedLong> delta(Number value); @Override Counter times(Number value); @Override Counter divideBy(Number value); @Override MetricType getType(); @Override int intValue(); @Override long longValue(); @Override float floatValue(); @Override double doubleValue(); static final String NAN_ON_COUNTER_WRAP_SYS_PROP; static boolean NAN_ON_COUNTER_WRAP; }### Answer:
@Test public void testDelta() { Counter c0 = new Counter(UnsignedLong.fromLongBits(0xFFFFFFFEL)); Counter c1 = new Counter(UnsignedLong.fromLongBits(0xFFFFFFFFL)); assertThat((Counter) c1.delta(c0), is(new Counter(1L))); }
@Test public void testDeltaWrap64() { Counter c0 = new Counter(UnsignedLong.fromLongBits(0xFFFFFFFFFFFFFFFAL)); Counter c1 = new Counter(4L); assertThat((Counter) c1.delta(c0), is(new Counter(10L))); }
@Test public void testDeltaWrap32() { Counter c0 = new Counter(UnsignedLong.fromLongBits(0xFFFFFFFAL)); Counter c1 = new Counter(4L); assertThat((Counter) c1.delta(c0), is(new Counter(10L))); }