int 转十六进制

//使用1字节就可以表示b
public static String numToHex8(int b) {
        return String.format("%02x", b);//2表示需要两个16进行数
    }
//需要使用2字节表示b
public static String numToHex16(int b) {
        return String.format("%04x", b);
    }
//需要使用4字节表示b
public static String numToHex32(int b) {
        return String.format("%08x", b);
    }


原文地址:https://www.cnblogs.com/the-wang/p/9690072.html