Java Byte Array Dump dumpArray(byte[] b)

Here you can find the source of dumpArray(byte[] b)

Description

dump Array

License

Open Source License

Declaration

public static String dumpArray(byte[] b) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String dumpArray(byte[] b) {
        StringBuilder sb = new StringBuilder("byte[" + b.length + "]={");
        for (int i = 0; i < b.length; i++) {
            if (i > 0)
                sb.append(",");
            sb.append("0x");
            if ((b[i] & 0xF0) == 0)
                sb.append("0");
            sb.append(Integer.toHexString(b[i] & 0xFF).toUpperCase());
        }/*from  ww  w.  j a v a2  s  . c o  m*/
        sb.append("}");
        return sb.toString();
    }
}

Related

  1. dump(byte[] data, int pos, int length)
  2. dump(byte[] mem, int start, int len)
  3. dump(byte[] rec)
  4. dump(byte[] str)
  5. dumpArray(byte b[])
  6. dumpArray(byte[] buffer, boolean breakLines)
  7. dumpByteArray(byte[] ab)
  8. dumpByteArray(byte[] b)
  9. dumpByteArray(byte[] buffer)