Here you can find the source of toDigit(char ch)
private static int toDigit(char ch)
//package com.java2s; //License from project: Apache License public class Main { /**/*w w w .j a va2 s . c om*/ * Converts the character to a digit, throws an IllegalStateException if it isn't a * valid digit. */ private static int toDigit(char ch) { if (('0' <= ch) && (ch <= '9')) { return ch - '0'; } throw new IllegalStateException(); } }