1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | /* Convert binary number to decimal number example. This example shows how to convert binary integer number to decimal integer number using valueOf method of Integer wrapper class. */ public class ConvertBinaryToDecimalNumber { public static void main(String[] args) { //declare string containing binary number String strBinaryNumber = "111000"; /* * to convert binary number to decimal number use, * int parseInt method of Integer wrapper class. * * Pass 2 as redix second argument. */ int decimalNumber = Integer.parseInt(strBinaryNumber,2); System.out.println("Binary number converted to decimal number"); System.out.println("Decimal number is : " + decimalNumber); } } /* Output would be Binary number converted to decimal number Decimal number is : 56 */ |

Thanks for the codes and I hope you’ll do more codes..hehe

God bless..

Hi..Thanks you so much for the codes.It helps me a lot…gbu..

nice..tnx ..hmm. ..

change your code not using java methods!