标签:
/* 用于进制转换的函数 */ private static void trans(int num,int base,int offset){ char[] chs ={‘0‘,‘1‘,‘2‘,‘3‘, ‘4‘,‘5‘,‘6‘,‘7‘, ‘8‘,‘9‘,‘A‘,‘B‘, ‘C‘,‘D‘,‘E‘,‘F‘}; char[] arr = new char[32]; int pos = arr.length; while(num!=0){ int temp = num & base; arr[--pos] = chs[temp]; num = num >>> offset; } for(int x = pos; x<arr.length; x++){ System.out.println(arr[x]); } System.out.println(); }
标签:
原文地址:http://www.cnblogs.com/luihengk/p/4631202.html