提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
将二进制数转换为十进制数
/* from nowjava - 时 代 Java*/ public class Main { public static void main(String[] args) { //declare string containing binary number String strBinaryNumber = "111000"; int decimalNumber = Integer.parseInt(strBinaryNumber,2); System.out.println("Binary number converted to decimal number"); System.out.println("Decimal number is : " + decimalNumber); } }/** from n o w j a v a . c o m - 时代Java**/