package day3;
public class test03 {
public static void main(String args[])
{
int num = 198;
StringBuffer sb = new StringBuffer();
char[] buf = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
for(int i=0; i<8; i++)
{
int temp = num&0x0000000f;
sb.append(buf[temp]); //查表
//sb.append(Character.forDigit(temp, 16)); //调用Character的静态方法将数字转指定基数的字符
num = num>>4;
}
sb.reverse();
System.out.println(sb);
}
}
day3 test03
最新推荐文章于 2022-05-31 12:57:35 发布