Java Byte Array Dump dumpBytes(byte[] bytes)

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

Description

dump Bytes

License

Open Source License

Declaration

public static String dumpBytes(byte[] bytes) 

Method Source Code

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

public class Main {
    protected final static char[] hexArray = "0123456789ABCDEF".toCharArray();

    public static String dumpBytes(byte[] bytes) {
        char[] hexChars = new char[bytes.length * 2];
        for (int i = 0; i < bytes.length; i++) {
            int val = bytes[i] & 0xFF;
            hexChars[i * 2] = hexArray[val >>> 4];
            hexChars[i * 2 + 1] = hexArray[val & 0x0F];
        }// w  w w.j a va  2 s. c  o m
        return new String(hexChars);
    }
}

Related

  1. dumpBytes(byte[] a)
  2. dumpBytes(byte[] b)
  3. dumpBytes(byte[] buffer)
  4. dumpBytes(byte[] buffer)
  5. dumpBytes(byte[] bytes)
  6. dumpBytes(byte[] bytes)
  7. dumpBytes(byte[] bytes, int maxLen)
  8. dumpBytes(byte[] bytes, int start, int length)
  9. dumpBytes(byte[] byts, int offset, int length)