### Question:
DataStream { @NonNull public Data toData() { return new Data(buffer.toByteArray()); } DataStream(); @SuppressWarnings("SimplifiableIfStatement") boolean write(@Nullable final byte[] data); boolean write(@Nullable final byte[] data,
						 @IntRange(from = 0) final int offset, @IntRange(from = 0) final int length); boolean write(@Nullable final Data data); @IntRange(from = 0) int size(); @NonNull byte[] toByteArray(); @NonNull Data toData();  }### Answer:
@SuppressWarnings("ConstantConditions") @Test public void toData() { final DataStream stream = new DataStream(); stream.write(new byte[] { 0, 1, 2, 3, 4, 5, 6}); final Data data = stream.toData(); assertEquals(0x100, data.getIntValue(Data.FORMAT_UINT16, 0).intValue()); }