code: public static IoBuffer allocate(int capacity, boolean direct) {
      if (capacity < 0) {
        throw new IllegalArgumentException("capacity: " + capacity);
      }
  
      return allocator.allocate(capacity, direct);
    }
docs: Returns the buffer which is capable of the specified size.
  
  @param capacity the capacity of the buffer
  @param direct <tt>true</tt> to get a direct buffer, <tt>false</tt> to get a heap buffer.