class Komi
{
public static void main(String [] args)
{
toBin(60);
}
public static void toBin(int num)
{
zhuanhuan(num,15,4);
}
public static void zhuanhuan(int num, int yuzhi, int yidong)
{
char biao []={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G'};
char arr []=new char[32];
int pos=arr.length;
while(num!=0)
{
int temp=num & yuzhi;
arr[--pos]=biao[temp];
num=num >>> yidong;
}
for(int x=pos;x<arr.length;x++)
{
System.out.print(arr[x]);
}
}
} |