class Test283 { fun moveZeroes(nums: IntArray): Unit { val size = nums.size; if (size==1) { return } var i = 0; while (i < size-1){ if (nums[i]==0){ var j = i+1 while ( j < size && nums[j]==0 ){ j++ } if (j==size){ return } nums[i] = nums[j] nums[j] = 0 } i++ } } fun test(){ val array = intArrayOf(0,1,0,3,12) for (i in array){ print(i) print(",") } print("\n") moveZeroes(array) for (j in array){ print(j) print(",") } } }