在 java 中将字节转换为字符串
使用 String(byte[]) 构造函数将字节数组转换为字符串。
示例
public class Tester {
public static void main(String[] args) {
String test = "I love learning Java";
byte[] bytes = test.getBytes();
String converted = new String(bytes);
System.out.println(converted);
}
}输出
I love learning Java
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP