### Question:
Unpooled { public static ByteBuf copiedBuffer(byte[] array) { if (array.length == 0) { return EMPTY_BUFFER; } return wrappedBuffer(array.clone()); } private  Unpooled(); static ByteBuf buffer(); static ByteBuf directBuffer(); static ByteBuf buffer(int initialCapacity); static ByteBuf directBuffer(int initialCapacity); static ByteBuf buffer(int initialCapacity, int maxCapacity); static ByteBuf directBuffer(int initialCapacity, int maxCapacity); static ByteBuf wrappedBuffer(byte[] array); static ByteBuf wrappedBuffer(byte[] array, int offset, int length); static ByteBuf wrappedBuffer(ByteBuffer buffer); static ByteBuf wrappedBuffer(long memoryAddress, int size, boolean doFree); static ByteBuf wrappedBuffer(ByteBuf buffer); static ByteBuf wrappedBuffer(byte[]... arrays); static ByteBuf wrappedBuffer(ByteBuf... buffers); static ByteBuf wrappedBuffer(ByteBuffer... buffers); static ByteBuf wrappedBuffer(int maxNumComponents, byte[]... arrays); static ByteBuf wrappedBuffer(int maxNumComponents, ByteBuf... buffers); static ByteBuf wrappedBuffer(int maxNumComponents, ByteBuffer... buffers); static CompositeByteBuf compositeBuffer(); static CompositeByteBuf compositeBuffer(int maxNumComponents); static ByteBuf copiedBuffer(byte[] array); static ByteBuf copiedBuffer(byte[] array, int offset, int length); static ByteBuf copiedBuffer(ByteBuffer buffer); static ByteBuf copiedBuffer(ByteBuf buffer); static ByteBuf copiedBuffer(byte[]... arrays); static ByteBuf copiedBuffer(ByteBuf... buffers); static ByteBuf copiedBuffer(ByteBuffer... buffers); static ByteBuf copiedBuffer(CharSequence string, Charset charset); static ByteBuf copiedBuffer(
            CharSequence string, int offset, int length, Charset charset); static ByteBuf copiedBuffer(char[] array, Charset charset); static ByteBuf copiedBuffer(char[] array, int offset, int length, Charset charset); @Deprecated static ByteBuf unmodifiableBuffer(ByteBuf buffer); static ByteBuf copyInt(int value); static ByteBuf copyInt(int... values); static ByteBuf copyShort(int value); static ByteBuf copyShort(short... values); static ByteBuf copyShort(int... values); static ByteBuf copyMedium(int value); static ByteBuf copyMedium(int... values); static ByteBuf copyLong(long value); static ByteBuf copyLong(long... values); static ByteBuf copyBoolean(boolean value); static ByteBuf copyBoolean(boolean... values); static ByteBuf copyFloat(float value); static ByteBuf copyFloat(float... values); static ByteBuf copyDouble(double value); static ByteBuf copyDouble(double... values); static ByteBuf unreleasableBuffer(ByteBuf buf); @Deprecated static ByteBuf unmodifiableBuffer(ByteBuf... buffers); static ByteBuf wrappedUnmodifiableBuffer(ByteBuf... buffers); static final ByteOrder BIG_ENDIAN; static final ByteOrder LITTLE_ENDIAN; static final ByteBuf EMPTY_BUFFER; }### Answer:
@Test public void testCopiedBuffer() { ByteBuf copied = copiedBuffer(ByteBuffer.allocateDirect(16)); assertEquals(16, copied.capacity()); copied.release(); assertEqualsAndRelease(wrappedBuffer(new byte[] { 1, 2, 3 }), copiedBuffer(new byte[][] { new byte[] { 1, 2, 3 } })); assertEqualsAndRelease(wrappedBuffer(new byte[] { 1, 2, 3 }), copiedBuffer(new byte[] { 1 }, new byte[] { 2 }, new byte[] { 3 })); assertEqualsAndRelease(wrappedBuffer(new byte[] { 1, 2, 3 }), copiedBuffer(new ByteBuf[] { wrappedBuffer(new byte[] { 1, 2, 3 })})); assertEqualsAndRelease(wrappedBuffer(new byte[] { 1, 2, 3 }), copiedBuffer(wrappedBuffer(new byte[] { 1 }), wrappedBuffer(new byte[] { 2 }), wrappedBuffer(new byte[] { 3 }))); assertEqualsAndRelease(wrappedBuffer(new byte[] { 1, 2, 3 }), copiedBuffer(new ByteBuffer[] { ByteBuffer.wrap(new byte[] { 1, 2, 3 }) })); assertEqualsAndRelease(wrappedBuffer(new byte[] { 1, 2, 3 }), copiedBuffer(ByteBuffer.wrap(new byte[] { 1 }), ByteBuffer.wrap(new byte[] { 2 }), ByteBuffer.wrap(new byte[] { 3 }))); }