Privacy Policy Terms Of Use. Copyright © 2006-2010 Java Tutorials and Examples.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
- /*
- * Convert Binary to Decimal example. Program to convert binary number
- * to decimal number.
- */
- public class BinaryToDecimal {
- public static void main(String args[]){
- //string having binary number
- String binaryString = new String("10101");
- /*
- * To convert binary number to decimal number use
- * static parseInt method of Integer wrapper class.
- *
- * Radix will be 2 in this case.
- */
- int dNumber = Integer.parseInt(binaryString, 2);
- System.out.println("Binary number converted to decimal number: " + dNumber);
- }
- }

Post new comment