Java Byte Array Print printBytes(byte[] bytes)

Here you can find the source of printBytes(byte[] bytes)

Description

print Bytes

License

Apache License

Declaration

public static void printBytes(byte[] bytes) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static void printBytes(byte[] bytes) {
        if (bytes == null || bytes.length <= 0) {
            System.out.println("Empty byte array.");
            return;
        }//from  w ww. ja v a  2s.c  om
        StringBuilder sb = new StringBuilder();
        sb.append("Total length:");
        sb.append(bytes.length);
        sb.append(",[");
        for (byte b : bytes) {
            sb.append(b);
            sb.append(",");
        }
        sb.append("]");
        System.out.println(sb.toString());
    }
}

Related

  1. printByteArrayAsChars(byte[] bytes)
  2. printByteArrayToHex(byte[] byteArray, int length)
  3. printByteHexEncoded(byte b)
  4. printBytes(byte[] ba)
  5. printBytes(byte[] buffer, int start, int length)
  6. printBytes(byte[] bytes)
  7. printBytes(byte[] bytes)
  8. printBytes(byte[] bytes)
  9. printBytes(byte[] bytes, int offset)