title: Divide a string into an ArrayList
body: <p>I'm trying to divide a String into arrays. The overall program is supposed to turn binary into a string but the problem I'm having is dividing the string into arrays. I feel stupid because this seems like a simple thing to do. the binary comes like this "0100100001001001" instead of "01001000" "01001001".</p>
  
  <pre><code>public static ArrayList&lt;String&gt; divStr(String str,int div){
  
      String addable = "";
      ArrayList&lt;String&gt; ret = new ArrayList&lt;String&gt;();
      for(int i = 0; i &lt; str.length();i++){
        addable += str.charAt(i);
        if(i % div == 0 &amp;&amp; i != 0){
          ret.add(addable);
          addable = "";
        }
      }
      return ret;
    }
  </code></pre>