I’d write a very small class that does the looping interation. It only offers a constructor, taking the length of the loop, a method “iterate” and a method int value() to get the current index it is pointing on.
              
              
              1 Like