In this section, you will learn to change binary number into decimal.
Integer wrapper class offers Integer.parseInt(String s,int radix) method to convert binary ,octal and hex number to decimal number.Here parameter s is the string form of the binary,octal or hex number, and int radix, which indicates in what base (for example binary, octal, or hexadecimal) the first argument is represented.
The method Integer.parseInt(String s,int radix) can be used only for the numbers whose size is less than 32 bits.The method throws unchecked run-time exception, java.lang.NumberFormatException when it is applied for numbers whose size greater than 32 bits.
Long wrapper class also offers Long.parseLong(String s,int radix) method which you can use to convert binary,octal and hex numbers to decimal numbers.This method supports numbers with size less than 64 bits.
Use java.math.BigInteger class, when you need to convert binary,octal and hex numbers with size greater than 64 bits.