```
public static int addDigits(int num) {
int sum=0;
while(num != 0 ){
int last_digit = num % 10;
sum += last_digit;
num = num/10;
}
if(checkSum(sum)){
return addDigits(sum);
}
return sum;
}
private static boolean checkSum(int x) {
boolean isDoubleDigit = (x > 9 && x < 100);
return isDoubleDigit;
```