Even though question asks answer for non-negative integer, this one works for +ve and -ve numbers.

I referred this code on stackoverflow.

Note: Negative numbers have digit sum as negative number. If positive digit sum needed for negative numbers then Math.abs() can be used while returning result.

```
public class Solution {
public int addDigits(int num) {
return 1 + (num-1)%9;
}
}
```