怎么写呢?这是我写的 可是10输出的是111啊 什么问题呢?
public class Demo
{
public static void main(String[] args)
{
int bb[]=new int[4];
for(int x=0;x<4;x++)
{
for(int a=10;a>0;a/=2)
{
bb[x]=a%2;
}
}
for(int x=3;x>0;x--)
{
System.out.print(bb[x]);
}
System.out.println(1%2);*/
}
}
后面这些应该是你的测试程序吧!!! 哈哈
System.out.println();
int b=10;
System.out.println(Integer.toBinaryString(b));
还有经过你的点拨 我明白了 非常感谢!!!