```
public class Solution {
public void moveZeroes(int[] nums) {
if (nums == null || nums.length < 2)
return;
int p;
for (int i = 0; i < nums.length; i++) {
if (nums[i] == 0) {
p = i + 1;
if(p >= nums.length)
return;
while (nums[p] == 0)
if (++p >= nums.length)
return;
int t = nums[p];
nums[p] = nums[i];
nums[i] = t;
}
}
}
}
```