在 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