c3-34 case16 改进十进制转十六进制(上)
作者:互联网
public class Case16 {
public static void main(String [] args){
int number = 245;
int shang = number/16;//15
int yu = number%16;//5
char result;
String tex = "";
if(yu<9){
result = (char)('0'+(yu));
}else{
result =(char)('A'+(yu-10));
}
tex = result + tex;
yu = shang%16;
shang = shang/16;
if(yu<9){
result = (char)('0'+(yu-0));
}else{
result =(char) ('A'+(yu-10));
}
tex = result +tex;
System.out.println("245的十六进制是:"+tex);
}
}
标签:十六进制,String,case16,int,16,number,34,yu,public 来源: https://blog.csdn.net/weixin_58148840/article/details/121253939