String str = new String(byte[] theBytes);
byte[] theBytes = str.getBytes();
theBytes = str.getBytes(String charSet);
byte[] theBytes = str.getBytes();
theBytes = str.getBytes(String charSet);
本文介绍如何使用 Java 进行字符串与字节数组之间的相互转换。包括使用 String 类构造函数从字节数组创建字符串,以及利用特定字符集进行转换的方法。

被折叠的 条评论
为什么被折叠?