提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
将十进制整数转换为二进制数
public class Main { public static void main(String[] args) {/*from 时 代 Java - nowjava.com*/ int i = 56; String strBinaryNumber = Integer.toBinaryString(i); System.out.println("Convert decimal number to binary number example"); System.out.println("Binary value of " + i + " is " + strBinaryNumber); } }