title: How do I make a delay in Java?
body: <p>I am trying to do something in Java and I need something to wait / delay for an amount of seconds in a while loop.</p>
  
  <pre><code>while (true) {
      if (i == 3) {
          i = 0;
      }
  
      ceva[i].setSelected(true);
  
      // I need to wait here
  
      ceva[i].setSelected(false);
  
      // I need to wait here
  
      i++;
  }
  </code></pre>
  
  <p>I want to build a step sequencer and I'm new to Java. Any suggestions?</p>