Here you can find the source of toIntValue(char ch)
public static int toIntValue(char ch)
//package com.java2s; public class Main { public static int toIntValue(char ch) { if (!isDigit(ch)) { throw new IllegalArgumentException("The character " + ch + " is not in the range '0' - '9'"); }/*from w w w . j av a2s.c o m*/ return ch - 48; } public static int toIntValue(char ch, int defaultValue) { if (!isDigit(ch)) { return defaultValue; } return ch - 48; } public static int toIntValue(Character ch) { if (ch == null) { throw new IllegalArgumentException("The character must not be null"); } return toIntValue(ch.charValue()); } public static int toIntValue(Character ch, int defaultValue) { if (ch == null) { return defaultValue; } return toIntValue(ch.charValue(), defaultValue); } public static boolean isDigit(char c) { return (c >= '0') && (c <= '9'); } }