title: Variable-sized Array Initialization in Java
body: <p>I have an array of integers in Java that is initialized as follows:</p>
  
  <pre><code>public int MyNumbers[] = {0,0,0,0};
  </code></pre>
  
  <p>I would like to, however, initialize the array to a variable-length number of zeroes. </p>
  
  <pre><code>private int number_of_elements = 4;
  public int MyNumbers[] = {0} * number_of_elements; // ????
  </code></pre>
  
  <p>I am clueless how to do this being new to Java coming from C. Any suggestions?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I know I could use a <code>for</code> loop, but I hoping there was a simple way to do it.</p>