Here you can find the source of charToInt(char c)
public static int charToInt(char c)
//package com.java2s; // Licensed under the Academic Free License version 3.0 public class Main { /**/*from w w w .j a v a2 s . c o m*/ * Convert a character to a digit. For example * the char '3' will return 3. */ public static int charToInt(char c) { int x = c - '0'; if (x < 0 || x > 9) throw new IllegalArgumentException("'" + (char) c + "'"); return x; } }