📜  java int 到二进制字符串 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:48.938000             🧑  作者: Mango

代码示例1
public static String makeBinaryString(int n) {
    StringBuilder sb = new StringBuilder();
    while (n > 0) {
    sb.append(n % 2);
        n /= 2;
    }
      sb.reverse();      
      return sb.toString();
}