JAVA內建Integer.toBinaryString()
import java.util.Scanner;
public class Java{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
~記得輸入不只一行~
System.out.println(Integer.toBinaryString(sc.nextInt()));
~JAVA內建直接將輸入之整數轉換成二進位形式的字串~
}
}
}