Java Byte Array to Hex bytesToHex(byte[] raw)

Here you can find the source of bytesToHex(byte[] raw)

Description

bytes To Hex

License

Open Source License

Declaration

public static String bytesToHex(byte[] raw) 

Method Source Code

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

public class Main {
    private static final String HEXES = "0123456789ABCDEF";

    public static String bytesToHex(byte[] raw) {
        final StringBuilder hex = new StringBuilder(2 * raw.length);
        for (final byte b : raw)
            hex.append(HEXES.charAt((b & 0xF0) >> 4)).append(HEXES.charAt((b & 0x0F)));
        return hex.toString();
    }/* ww w .  ja  va2 s  .c o m*/
}

Related

  1. bytesToHex(byte[] data)
  2. bytesToHex(byte[] data, char[] chars)
  3. bytesToHex(byte[] data, int m, int n)
  4. bytesToHex(byte[] digest)
  5. bytesToHex(byte[] in)
  6. bytesToHex(byte[] raw)
  7. bytesToHex(byte[] raw)
  8. bytesToHex(final byte[] b)
  9. bytesToHex(final byte[] bytes)