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

The repeated addition of digits is equal to remainder when the number is divided by 9 in all cases except when the number is divisible by 9. If the number is divisible by 9, the sum is equal to 9 but remainder is zero.

The above code removes the need to use "if condition" for checking divisibility by 9.

I took clue from here. Thanks Marriema for the clue.

See here for more info.