Java adaptation of new OpenCL code: