title: How to split a string array into small chunk arrays in java?
body: <p>Below is the example of the code snippet which needs the help</p>
  
  <p>Example:</p>
  
  <pre><code>[1,2,3,4,5]
  </code></pre>
  
  <ul>
  <li>if the chunk size is <code>1</code>, <code>[1,2,3,4,5]</code></li>
  <li>if the chunk size is <code>2</code>, <code>[1,2]</code> and <code>[3,4]</code> and <code>[5]</code></li>
  <li>if the chunk size is <code>3</code>, <code>[1,2,3]</code> and <code>[4,5]</code></li>
  <li>if the chunk size is <code>4</code>, <code>[1,2,3,4]</code> and <code>[5]</code></li>
  </ul>
  
  <p>Java (from comment):</p>
  
  <pre><code>int counter = 0;
  for (int i=0; i&lt;array.length; i++) {
    if (count == chunksize) {
      //do something and initialize
      counter = 0;
    }
    counter++; 
  }
  </code></pre>