public static int putByteBuffer(byte[] bytes,int offset,ByteBuffer buf){
  int len=buf.remaining();
  buf.get(bytes,offset,len);
  return offset + len;
}

public static int putByteBuffer ( byte [ ] bytes , int offset , ByteBuffer buf ) { int len = buf . remaining ( ) ; buf . get ( bytes , offset , len ) ; return offset + len ; }
add the whole content of the bytebuffer to the bytes arrays . the bytebuffer is modified .
