```
public class Solution {
public int removeElement(int[] nums, int val) {
// length is the return array's length
int length = 0;
for(int i=0;i<nums.length;i++){
if(nums[i] == val)
continue;
//we can also use length as index to cover val...
nums[length] = nums[i];
length++;
}
return length;
}
}
```