字节数组到十六进制char数组的转换 [英] Byte array to hex char array conversion

查看:51
本文介绍了字节数组到十六进制char数组的转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的字节数组看起来像

 byte[] x = { (byte) 0xff , (byte) 0x80  };

如何将其转换为char数组{char [] y},其中:-

how can i convert it to char array {char[] y } where:-

y[0]='f';
y[1] ='f' and so on

推荐答案

这应该对您有帮助:

byte[] data = { (byte) 0xff , (byte) 0x80  };
String text = new String(data, "UTF-8");
char[] chars = text.toCharArray();

这篇关于字节数组到十六进制char数组的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆