Are you really asking about C here in the beginner's
Java forum?
In 'C', the traditional technique is just to use (c - 48) as the value of a decimal digit, where c is a character known to be in the range 0-9. If the character is a-D or a-d, then you have to check for those and use 10-15.
In Java, you can use the static method Character.getNumericValue() method, which can handle decimal and hexidecimal digits for many international character sets.