More optimizations using java arrays; neighbour pixels