```
int newInteger(int n) {
int res = 0, s = 1;
while (n > 0) {
res += n % 9 * s;
n /= 9;
s *= 10;
}
return res;
}
```

You may already know binary and decimal where number goes up to a more significant digit when it hits two or ten. e.g. 2^1=>10, 2^2=>100, 2^3=>1000.

The problem here is almost the same. When it hits 9 it goes up. e.g. 9^1=>10, 9^2=>100, 9^3=>1000, etc. Simply use our math knowledge to convert back making use of division and modulo.