如何在 Java 中列印一個位元組陣列?
你可以簡單地迭代位元組陣列並使用 System.out.println() 方法列印位元組。
示例
public class Tester { public static void main(String[] args) { byte[] a = { 1,2,3}; for(int i=0; i< a.length ; i++) { System.out.print(a[i] +" "); } } }
輸出
1 2 3
廣告
你可以簡單地迭代位元組陣列並使用 System.out.println() 方法列印位元組。
public class Tester { public static void main(String[] args) { byte[] a = { 1,2,3}; for(int i=0; i< a.length ; i++) { System.out.print(a[i] +" "); } } }
1 2 3