//定义功能:转换
public 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 i = pos; i < arr.length; i++) {
System.out.print(arr[i]);
}
}