class Number
{
public static void main(String[] args)
{
System.out.println("Hello World!");
System.out.println("----------------");
toBin(6);
}
public static void toBin(int num)
{
StringBuffer sb= new StringBuffer();
if (num>0)
{
System.out.println(num%2);
num=num/2;
}
}
}
这个运行结果为什么是0? |
|