Java代码实现:

public class Main {
    public static void main(String[] args) {
        int decimal = 1618801067;
        String hex = Integer.toHexString(decimal).toUpperCase();
        System.out.println("16进制:" + hex);
        
        String reverseHex = new StringBuilder(hex).reverse().toString();
        System.out.println("反序:" + reverseHex);
        
        String lastTwoChars = hex.substring(hex.length() - 2);
        System.out.println("最后两个字符:" + lastTwoChars);
        
        String reverseLastTwoChars = new StringBuilder(lastTwoChars).reverse().toString();
        System.out.println("最后两个字符反序:" + reverseLastTwoChars);
    }
}

输出结果:

16进制:607CF1AB
反序:ABF17C60
最后两个字符:AB
最后两个字符反序:BA
java 代码 :十进制:1618801067 转为16进制为: 607CF1AB 最后两个字符一起反序:ABF17C60

原文地址: https://www.cveoy.top/t/topic/bsY9 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录