美文网首页
Java ascii 码 转字符串

Java ascii 码 转字符串

作者: Mr菜头 | 来源:发表于2020-10-24 15:10 被阅读0次

ascii 是 用 16 进制表示字符

public static void main(String[] args) {
        String HexStr = "30 32 43 35 2C 31 2C 31 2C 23 30 23";
        String[] hexChars = HexStr.split(" ");
        StringBuffer sb = new StringBuffer();
        for(String ch:hexChars) {
            
            sb.append((char)Integer.parseInt(ch,16));
        }
        
        System.out.println(sb.toString());
    }

相关文章

网友评论

      本文标题:Java ascii 码 转字符串

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