title: assign value to every item in arraylist
body: <p>I have an arraylist with integers that represent a person. I want to assign every 4th person a tablenumber, but there are more then 4 people in that arraylist, so I want to </p>
  
  <ul>
  <li>assign the next 4 people to a different table, and the</li>
  <li>4 people after that to a new table</li>
  </ul>
  
  <p>How can I do that?</p>
  
  <p>This is what I've tried so far:</p>
  
  <pre><code>    try {
          String[] toernooi = toernooien2.getSelectedItem().toString().split(" ");
  
          PreparedStatement stat = con.prepareStatement("SELECT speler FROM fullhouse.inschrijving_toernooi WHERE IT_betaaldatum is not null AND toernooi = ?;");
          stat.setString(1, toernooi[0]);
          ResultSet resultaat = stat.executeQuery();
          ArrayList&lt;Integer&gt; array = new ArrayList&lt;&gt;();
  
          PreparedStatement stat2 = con.prepareStatement("INSERT INTO fullhouse.indeling (person,tablenumber,ronde) VALUES (?,?,?)");
  
          for (int i = 1; resultaat.next(); i++) {
              stat2.setInt(1, resultaat.getInt(1));
              array.add(resultaat.getInt(1));
              stat2.execute();
  
              for (Integer arrayitem : array) 
              {
  
              }
  
          }
  </code></pre>