public static ByteBuffer createByteBuffer(byte... data) {
        ByteBuffer bb = createByteBuffer(data.length);
        bb.put(data);
        bb.flip();
        return bb;
    }
Create a new ByteBuffer of an appropriate size to hold the specified
number of ints only if the given buffer if not already the right size.

@param buf
           the buffer to first check and rewind
@param size
           number of bytes that need to be held by the newly created
           buffer
@return the requested new IntBuffer
jme3-core/src/main/java/com/jme3/util/BufferUtils.java