5.2---小数的二进制表示(CC150)
public static String printBin(double num) { StringBuffer str = new StringBuffer(); str.append('0'); str.append('.'); while(num != 0.0){ num = num * 2; if(str.length() >= 32){ return "Error"; } str.append((int)num); num = num - (int)num; } return str.toString(); }