在 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