public class MoveZeroes {
public static void main(String[] args) {
// TODO Auto-generated method stub
}
public void moveZeroes(int[] nums) {
int end=0;
int count=nums.length;
for(int i=0;i<count;i++){
if(nums[i]!=0){
nums[end]=nums[i];
end++;
}
}
for(int i=end;i<count;i++){
//循环里用i
nums[i]=0;
}
}
}
阅读(723) | 评论(0) | 转发(0) |