如何在 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

更新於:2020-02-24

1.6 萬+ 次瀏覽

開啟你的 職業生涯

完成課程獲得認證

開始吧
廣告
© . All rights reserved.