`for (uint i=0; i < intervals.length; i += 2)` and use `i` and `i + 1` inside

BTW all operators should have spaces around them...