title: How can I initialize an ArrayList with all zeroes in Java?
body: <p>It looks like <code>arraylist</code> is not doing its job for presizing:</p>
  
  <pre><code>// presizing 
  
  ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(60);
  </code></pre>
  
  <p>Afterwards when I try to access it:</p>
  
  <pre><code>list.get(5) 
  </code></pre>
  
  <p>Instead of returning 0 it throws <em>IndexOutOfBoundsException: Index 5 out of bounds for length 0</em>.</p>
  
  <p>Is there a way to initialize all elements to 0 of an exact size like what C++ does?</p>