Here you can find the source of charToInt(char c)
Parameter | Description |
---|---|
c | a parameter |
public static int charToInt(char c)
//package com.java2s; //License from project: Academic Free License public class Main { public static final int PAD_VALUE = 65; /**// w w w . j a v a2s . c o m * Converts character to number. Array lookup would be faster. * * @param c * @return */ public static int charToInt(char c) { int val = PAD_VALUE; // first the capital letters if (c >= 'A' && c <= 'Z') { val = c - 'A'; } // lower case else if (c >= 'a' && c <= 'z') { val = c - 'a' + 26; } // numbers else if (c >= '0' && c <= '9') { val = c - '0' + 52; } // specials else if (c == '+') { val = 62; } else if (c == '/') { val = 63; } return val; } }