```
public int removeDuplicates(int[] nums) {
if(nums == null || nums.length == 0) return 0;
int now = nums[0];
int num = 1;
for (int i = 1; i < nums.length; i++) {
if (now == nums[i]) continue;
num++;
now =nums[i];
}
return num;
}
```

where is my code's wrong?

Input:

[1,1,2]

Output:

[1,1]

Expected:

[1,2]