@elect Given the computational nature of your problem, I would also consider using the java-native stream() features instead. See below (note, I might have done some error in the conversion to / from flat array to 3d coords here, haven’t double checked).