title: Swapping element in an array
body: <p>I've been trying to work this out:</p>
  
  <p>Say I have an array:</p>
  
  <pre><code>int[] n = {0, 0, -1, 1, 0, 1, 1, -1, 1};
  </code></pre>
  
  <p>I need to be able to sort through the array and if there is a zero with a non zero preceding it, then they should be swapped.</p>
  
  <p>For example: <code>0, 0, -1, 1, 0, 1, 1, -1, 1</code></p>
  
  <p>will become: <code>0, 0, -1, 0, 1, 1, 1, -1, 1</code></p>
  
  <p>I have been trying to do it using a <code>for</code> loop and <code>if</code> statements with no luck. Any tips?</p>