title: Remove all zeros from array
body: <p>I have an array:</p>
  
  <pre><code>[0, 5, 6, 0, 0, 2, 5]
  </code></pre>
  
  <p>I would like to remove all zeros from it, so that this returns (keeping the same order):</p>
  
  <pre><code>[5, 6, 2, 5]
  </code></pre>
  
  <p>Is there any easier way to remove all zeros than the following?</p>
  
  <pre><code>int[] array = {0, 5, 6, 0, 0, 2, 5};
          int len = 0;
          for (int i=0; i&lt;array.length; i++){
              if (array[i] != 0)
                  len++;
          }
          int [] newArray = new int[len];
          for (int i=0, j=0; i&lt;array.length; i++){
              if (array[i] != 0) {
                  newArray[j] = array[i];
                  j++;
              }
          }
  </code></pre>
  
  <p>I haven't been able to find any method in the Arrays class, and Google/SO searches didn't give me any good answers. </p>