title: Pausing a for loop in java
body: <p>Is there a way to pause a for loop in java? So is there a way to only go forward one iteration when prompted? I read this <a href="http://answers.yahoo.com/question/index?qid=20100212201605AAazS73" rel="nofollow">http://answers.yahoo.com/question/index?qid=20100212201605AAazS73</a> and the solution seems like it could have some problems mostly because I don't fully understand the order the for loop checks its header. The only method I could think of that could accomplish something similar is the following</p>
  
  <pre><code>    do {
          if (FLAG) {
              //Do procedure
              i++;
              FLAG = false;
          }
      } while ( i &lt; 6);
  </code></pre>
  
  <p>When the flag is true the procedure is done and the counter moves forward one. I don't like this, though, because it will keep looping as long as the counter is below 6, if I am not mistaken. Any ideas?</p>
  
  <p>-Sorry for the lack of clarity. The FLAG in my case would be a static boolean that could be called from another class. The procedure I allude to is dependent on i. </p>