public static void number(int d) {
int a = d;
List<String> list = new ArrayList<>();
boolean s = true;
while (s) {
list.add(a % 2 + "");
a = a / 2;
if (a == 0) {
s = false;
}
}
for (int i = list.size() - 1; i >= 0; i--) {
System.out.print(list.get(i));
}
}
实现简单的二进制
最新推荐文章于 2024-03-21 21:45:00 发布