ArrayHelper: remove a layer of array access in the inner loop