Java Hex Calculate toHex(byte[] raw)

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

Description

to Hex

License

Open Source License

Declaration

public static String toHex(byte[] raw) 

Method Source Code

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

public class Main {
    public static String toHex(byte[] raw) {
        final String HEXES = "0123456789ABCDEF";
        if (raw == null) {
            return null;
        }// w  w  w  .  j  a v a 2  s  .c  om
        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))).append(" ");
        }
        return hex.toString();
    }
}

Related

  1. toHex(byte[] digest)
  2. toHex(byte[] digest)
  3. toHex(byte[] inBytes)
  4. toHex(byte[] input)
  5. toHex(byte[] key)
  6. toHex(byte[] raw)
  7. toHex(byte[] raw)
  8. ToHex(byte[] src)
  9. toHex(byte[] src)