Self explanatory :)

```
public class NumArray {
int nums[];
public NumArray(int[] nums) {
this.nums = nums;
int sum = 0;
for(int i=0;i<nums.length;i++) {
sum += nums[i];
nums[i] = sum;
}
}
public int sumRange(int i, int j) {
if(i == 0) {
return nums[j];
}
return nums[j]-nums[i-1];
}
}
```