title: "If statement" continuously checking for multiples of for loop's index count
body: <p>I have a for loop that checks for every 5th position. And at every 5th position, I'm performing an action like so (which works):</p>
  
  <pre><code>for(int i = 0; i &lt; foo().length; i++)
  {
      System.out.print(i);
  
      if(i == 5 || i == 10 || i == 15)
          System.out.println();
  }
  </code></pre>
  
  <p>Is there a way to write if statement so no matter how long <code>foo().length</code> is, I don't have to keep coming back to adjust it?  </p>