public static void toBin(int num)
{
//StringBuffer s = nuw StringBuffer();
//定义二进制表
char[] ch = new char[]{'0','1'};
//定义临时存储器
char[] arr = new char[32];
//定义指针
int p = arr.length;
while (num>0)
{
arr[--p] = ch[num & 1];
num = num >>> 1;
}
for(int i=p; i<arr.length; i++)
{
System.out.print(arr[p]);
}
}
}
class ArrayTest2
{
public static void main(String[] args)
{
toBin(6);
}
public static void toBin(int num)
{
//StringBuffer s = nuw StringBuffer();
//定义二进制表
char[] ch = new char[]{'0','1'};
//定义临时存储器
char[] arr = new char[32];
//定义指针
int p = arr.length;