请指点一二!
请问在java中如何显示以下图形10000000001
01000000010
00100000100
00010001000
00001010000
00000100000
00001010000
00010001000
00100000100
01000000010
10000000001
public class BinaryString { public static void main(String[] args) { int nums[] = {0x401, 0x202, 0x104, 0x88, 0x50, 0x20, 0x50, 0x88, 0x104, 0x202, 0x401}; for(int i = 0; i < nums.length; i++) System.out.println(toBinaryString(nums[i], 11)); } public String toBinaryString(int num, int digits) { StringBuilder sb = new StringBuilder(); for(int i = digits; i > -1; i--) sb.append(num >>> i & 1); return sb.toString(); } }