public class Solution {

```
public int missingNumber(int[] nums) {
int len = nums.length;
int sum = 0;
for(int i = 0; i < len; ++i)
sum += nums[i];
int ideal_sum = 0;
ideal_sum = (0+len)*(len+1)/2;
return ideal_sum - sum;
}
```

}