美文网首页
JDK17~21:java字节数组与16进制字符之间的转换

JDK17~21:java字节数组与16进制字符之间的转换

作者: 不知不怪 | 来源:发表于2024-10-28 11:01 被阅读0次

package com.ldr.common;

import java.util.HexFormat;

public class TTTTT {

static final HexFormat FORMAT = HexFormat.of();

public static void main(String[] args) {
    byte[] bytes = { 0x4a, 0x6f, 0x68, 0x6e };
    String hex = FORMAT.formatHex(bytes);
    System.out.println(hex);
    byte[] bytes1 = FORMAT.parseHex(hex);
    System.out.println(FORMAT.formatHex(bytes1));
}

}

相关文章

网友评论

      本文标题:JDK17~21:java字节数组与16进制字符之间的转换

      本文链接:https://www.haomeiwen.com/subject/sffpdjtx.html