## Question:

Hello. In the course of work, I had to check whether the last digit of the number is nine. While wrote the crutch

```
if(("" + num).endsWith("9"))
```

How can you check mathematically? Range [0, 99]

## Answer:

For example, like this:

```
Math.abs(n) % 10 == 9
```

If you know for sure that the number is positive, you don't have to evaluate `Math.abs`

.