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