To create a buffer you can use the allocate(int capacity) method call. Each buffer object has the allocate(int capacity) method. When calling this method you need to pass the value of the capacity of the buffer to be created.
The example below show you how to create the buffer object by calling its allocate() method.