Java examples for Data Structure:Algorithm
Convert binary number to decimal number
public class Main { public static void main(String[] args) { //declare string containing binary number String strBinaryNumber = "111000"; /*from www . ja v a2s . co m*/ int decimalNumber = Integer.parseInt(strBinaryNumber,2); System.out.println("Binary number converted to decimal number"); System.out.println("Decimal number is : " + decimalNumber); } }