Welcome to the Ranch
Quite a lot to comment about in that code. Please put spaces around your binary operators, which makes it easier to read. don’t use number literals like 48.
You should avoid number literals altogether, if possible. It is not clear what 48 means. If you wish to subtract the digit 0 from it, you can do arithmetic on
chars, with
- '0'. That is much easier to read.
There is something odd about subtracting 9. If you start with the value 7, then twice 7 will be more than 10, so you subtract 9 and get -2
The JVM doesn’t like looking for the minus 2nd letter in a String.