Java tutorial
public class Main { public static void main(String[] args) { int ch1 = 9; int ch2 = 3; int i1 = Character.digit(ch1, 2); int i2 = Character.digit(ch2, 10); System.out.println("Numeric value of " + ch1 + " in radix 2 is " + i1); System.out.println("Numeric value of " + ch2 + " in radix 10 is " + i2); } }