code: public boolean allocateArrayBufferIfFirstTimeOrArrayChanged(KernelArg arg, Object newRef, 
  		   			final int objArraySize, final int totalStructSize, final int totalBufferSize) {
  	   boolean didReallocate = false;
  	   
  	   if ((arg.getObjArrayBuffer() == null) || (newRef != arg.getArray())) {
  	      final ByteBuffer structBuffer = ByteBuffer.allocate(totalBufferSize);
  	      arg.setObjArrayByteBuffer(structBuffer.order(ByteOrder.LITTLE_ENDIAN));
  	      arg.setObjArrayBuffer(arg.getObjArrayByteBuffer().array());
  	      didReallocate = true;
  	      if (logger.isLoggable(Level.FINEST)) {
  	         logger.finest("objArraySize = " + objArraySize + " totalStructSize= " + totalStructSize + " totalBufferSize="
  	               + totalBufferSize);
  	      }
  	   } else {
  	      arg.getObjArrayByteBuffer().clear();
  	   }
  	   
  	   return didReallocate;
     }
docs: Helper method that manages the memory allocation for storing the kernel argument data,
  so that the data can be exchanged between the host and the OpenCL device.
  @param arg the kernel argument
  @param newRef the actual Java data instance
  @param objArraySize the number of elements in the Java array
  @param totalStructSize  the size of each target array element
  @param totalBufferSize the total buffer size including memory alignment
  @return <ul><li>true, if internal buffer had to be allocated or reallocated holding the data</li>
  <li>false, if buffer didn't change and is already allocated</li></ul>