Hardly a beginner's topic!
No, it is not the right way to do it. If you take the value of a char, you might get 'A' = 0x41 (65). You could try several things:
Integer.parseInt(myString.substring( . . . Character#getNumericValuecharAt() - '0'and there are bound to be others.At least the parsing methods will throw a nice Exception if your char isn't a number!