//An highlighted block
import java.util.Scanner;
public class Decimal2HexConversion {
private static int shift = 4;
public static void main(String[] args){
System.out.println("输入一个整数:");
Scanner input = new Scanner(System.in);
int num = input.nextInt();
String result = toHexString(num,shift);
System.out.print("转换为十六进制:"+result);
}
public static final int SIZE =32;//int型有32位
public static String toHexString(
仿照Java的Integer.toHexString()实现十进制转换十六进制
最新推荐文章于 2024-06-29 02:54:32 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)