### Question:
DataBuffer { public DataBuffer<T> put(Object val) { if (val instanceof Byte) { buffer.put((Byte)val); } else if (val instanceof Short) { buffer.putShort((Short)val); } else if (val instanceof Character) { buffer.putChar((Character)val); } else if (val instanceof Integer) { buffer.putInt((Integer)val); } else if (val instanceof Long) { buffer.putLong((Long)val); } else if (val instanceof Float) { buffer.putFloat((Float)val); } else if (val instanceof Double) { buffer.putDouble((Double)val); } else { throw new IllegalArgumentException("unknown data value: " + val); } return this; } DataBuffer(ByteBuffer buffer, DataType datatype); static DataBuffer create(ByteBuffer buffer, DataType datatype); static DataBuffer create(int size, DataType datatype); static DataBuffer<T> resample(DataBuffer<T> buffer, Dimension from, Dimension to); ByteBuffer buffer(); abstract T get(); T get(int i); DataBuffer<T> put(Object val); DataBuffer<T> put(int i, T val); DataBuffer<T> flip(); DataBuffer<T> rewind(); DataBuffer<T> word(); int size(); DataType datatype();  }### Answer:
@Test public void testPut() throws Exception { ByteBuffer bbuf = ByteBuffer.allocate(16); DataBuffer<Byte> nbuf = DataBuffer.create(bbuf, DataType.BYTE); for (int i = 0; i < 4; i++) { nbuf.put((byte)0).put((byte)0).put((byte)0).put((byte) (i + 1)); } bbuf.flip(); IntBuffer ibuf = bbuf.asIntBuffer(); assertEquals(1, ibuf.get()); assertEquals(2, ibuf.get()); assertEquals(3, ibuf.get()); assertEquals(4, ibuf.get()); }