public class ToBin { public static String toBinString1(int i) { return Integer.toBinaryString(i); } public static String toBinString2(int i) { //int 型是4个字节,32位,也就是说左移32次,每次移1位 StringBuilder builder = new StringBuilder(); int count = 32; while(count– > 0) { builder.append((…