public class Student {
public static void main(String[]args){
toer(60);
}
public static void toer(int sum){
jinzhi(sum,1,1);
}
public static void toba(int sum){
jinzhi(sum,7,3);
}
public static void toliu(int sum){
jinzhi(sum,15,4);
}
public static void jinzhi(int sum,int base,int you){
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(sum!=0){
int temp=sum&base;
arr[--pos]=chs[temp];
sum=sum>>>you;
}
for(int i=pos;i<arr.length;i++){
System.out.print(arr[i]);
}
}
}
|
|