在 Java 中将字节转换为字符串
使用 String(byte[]) 构造函数将 byte[] 转换为 String。
示例
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