package cn.imust.day;
public class TestChange {
public static void main(String[] args){
toHex(60);
}
private static void toHex(int num) {
// TODO Auto-generated method stub
//decimal system transfer to hexdecimal
StringBuffer sb=new StringBuffer();
for (int x=0;x<8 ;x++ )
{
int temp=num&15;
if (temp>9)
{
sb.append((char)(temp-10+'A'));
}
else
sb.append(temp);
num=num>>>4;
}
sb=sb.reverse();
// who know the methods to get rid of "0" before valid numbers
System.out.println(sb);
}
}