When the length of the array is confirmed to be 0 (mod n) where n is the increment value within the for loop, and this check is done immediately before the loop starts. As long as:
- the loop variable isn't modified anywhere else within the loop body
- the length of the array does not change (which will not happen for primitives unless reassigned).
we can be fairly certain that array accesses arr[i] .. arr[i + n - 1] will not be out-of bounds.
see: https://discuss.lgtm.com/t/false-positive-java-index-out-of-bounds-with-preconditions-check/1787