首页 > 代码库 > JAVA十六进制字符串与整型互相转换

JAVA十六进制字符串与整型互相转换

  public static void main(String[] args) {
        String str = "000AB";
        Integer in = Integer.valueOf(str,16);
        String st = Integer.toHexString(in).toUpperCase();
        st = String.format("%5s",st);
        st= st.replaceAll(" ","0");
    }

 

JAVA十六进制字符串与整型互相转换