public static String getBinaryString(int n) { String result = ""; while (n > 0) { result = n%2 + result; n/=2; } return result; }
十进制转2进制的java版