实现简单的二进制

xiaoxiao2021-02-28  106

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)); } }
转载请注明原文地址: https://www.6miu.com/read-96938.html

最新回复(0)