### Question:
DecimalOption extends ValueOption<DecimalOption> { @SuppressWarnings("deprecation") @Override public int restore(byte[] bytes, int offset, int limit) throws IOException { int cursor = offset; int head = bytes[cursor++] & 0xff; if ((head & MASK_PRESENT) == 0) { setNull(); } else { boolean plus = (head & MASK_PLUS) != 0; int scale = WritableComparator.readVInt(bytes, cursor); cursor += WritableUtils.decodeVIntSize(bytes[cursor]); int length = WritableComparator.readVInt(bytes, cursor); cursor += WritableUtils.decodeVIntSize(bytes[cursor]); DecimalBuffer buffer = BUFFER_MAIN.get(); buffer.set(plus, scale, bytes, cursor, length); cursor += length; modify(buffer.toBigDecimal()); } return cursor - offset; } DecimalOption();  DecimalOption(BigDecimal valueOrNull); BigDecimal get(); BigDecimal or(BigDecimal alternate); void add(BigDecimal delta); void add(DecimalOption other); @Deprecated DecimalOption modify(BigDecimal newValue); @Override @Deprecated void copyFrom(DecimalOption optionOrNull); @Override int hashCode(); @Override boolean equals(Object obj); boolean has(BigDecimal other); @Override int compareTo(WritableRawComparable o); @Override String toString(); @Override void write(DataOutput out); @SuppressWarnings("deprecation") @Override void readFields(DataInput in); @SuppressWarnings("deprecation") @Override int restore(byte[] bytes, int offset, int limit); @Override int getSizeInBytes(byte[] buf, int offset); @Override int compareInBytes(byte[] b1, int o1, byte[] b2, int o2); static int getBytesLength(byte[] bytes, int offset, int length); static int compareBytes(
            byte[] b1, int s1, int l1,
            byte[] b2, int s2, int l2);  }### Answer:
@Test public void writeNull() { DecimalOption option = new DecimalOption(); DecimalOption restored = restore(option); assertThat(restored.isNull(), is(true)); }
@Test public void stress_restore() throws Exception { int count = 10000000; DecimalOption value = new DecimalOption(new BigDecimal("3.14")); byte[] bytes = toBytes(value); DecimalOption buf = new DecimalOption(); for (int i = 0; i < count; i++) { buf.restore(bytes, 0, bytes.length); if (i == 0) { assertThat(buf, is(value)); } } }
@Test public void stress_restore_large() throws Exception { int count = 10000000; DecimalOption value = new DecimalOption(new BigDecimal(Long.MAX_VALUE).multiply(BigDecimal.TEN)); byte[] bytes = toBytes(value); DecimalOption buf = new DecimalOption(); for (int i = 0; i < count; i++) { buf.restore(bytes, 0, bytes.length); if (i == 0) { assertThat(buf, is(value)); } } }