题解 | #移动 0#
移动 0
http://www.nowcoder.com/practice/102586387caa4afcbad6f96affce9780
import java.util.*;
public class Solution { public static int[] moveZeroes (int[] nums) { List list=new ArrayList<>(); for (int i = 0; i < nums.length; i++) { if(nums[i]!=0) list.add(nums[i]); } int s=list.size(); for (int i = 0; i < (nums.length-s); i++) { list.add(0); } return list.stream().mapToInt(Integer::valueOf).toArray(); } }