十进制转换成十六进制
class ArrayText6
{
public static void main(String[] args)
{
toHex(60);
}
public static void toHex(int num) { char[]arr={'0','1','2','3', '4','5','6','7','8','9','A','B', 'C','D','E','F'}; char[]arr1=new char[8]; while(num!=0) { int i=0; int temp=num&15; arr1[i++]=arr[temp]; num=num>>>4; } for (int i=0;i<arr1.length;i++ ) { System.out.print(arr1[i]+','); }}}为什么我运行完之后是这样的结果9544444444444444
|