import java.util.*;


public class Solution {

    public int[] moveZeroes (int[] nums) {
        // write code here
        int[] ret = new int[nums.length];
        int i = 0;
        int j = 0;
        while(i < nums.length){
            while(i < nums.length && nums[i] == 0){
                i++;
            }
            if (i == nums.length){
                break;
            }
            ret[j++] = nums[i++];
        }

        return ret;
    }
}