//将字符串转换成二进制形式,中间用空格隔开 function strToBinary(str){ var result = []; var list = str.split(""); for(var i=0;i<list.length;i++){ if(i != 0){ result.push(" "); } var item = list[i]; var binaryStr = item.charCodeAt().toString(2); result.p
public class Binary { public static void main(String[] args) { // Print binary representation of N. int N = Integer.parseInt(args[0]); int v = 1; while(v <= N/2) v = 2*v; // Now v is the largest power of 2 <= N. int n = N; // current excess while (v