本帖最后由 冷风 于 2014-8-7 10:21 编辑
- class ChaZhao
- {
- public static void main(String[] args)
- {
- toHex(60);
- }
- public static void toHex(int num)
- {
- char[] chs={'0','1','2','3','4','5','6','7'
- ,'8','9','A','B','C','D','E','F'};
-
- char[] arr=new char[8];
- for (int x=0;x<8 ;x++ )
- {
- int temp=num&15;
- //System.out.println(chs[temp]);
- arr[x]=chs[temp];
- num=num>>>4;
- }
- for (int x=0; x<arr.length; x++)
- {
- System.out.print(arr[x]+',');
- }
- }
- }
复制代码
结果是11195929292929292,大神们帮我看看:dizzy: |