Java 程序:将整数反复除以 2 并排序数字
public class Test { public static void main(String[] args) { int i = 32; String s = ""; while(i > 0){ if(i % 2 != 0){ break; } s += i; i /= 2; } char[] ch = s.toCharArray(); Arrays.sort(ch); for (int j = ch.length - 1; j >= 0; j--) { System.out.print(ch[j]); } } }
原文地址: https://www.cveoy.top/t/topic/lj5b 著作权归作者所有。请勿转载和采集!