Java Hex Calculate toHexHashString(byte[] id)

Here you can find the source of toHexHashString(byte[] id)

Description

to Hex Hash String

License

Apache License

Declaration

public static String toHexHashString(byte[] id) 

Method Source Code

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

public class Main {
    private static final char[] HEX_CHARS = "0123456789abcdef".toCharArray();

    public static String toHexHashString(byte[] id) {
        StringBuilder sb = new StringBuilder(20);
        assert (id.length == 20);
        for (int i = 0; i < 20; i++) {
            int val = id[i] & 0xff;
            sb.append(HEX_CHARS[val >> 4]);
            sb.append(HEX_CHARS[val & 0xf]);
        }//from   w w  w. ja  v a 2  s  . c  om
        return sb.toString();
    }
}

Related

  1. toHexFromByte(byte b)
  2. toHexFromByte(final byte b)
  3. toHexFromBytes(byte[] bytes)
  4. toHexFromBytes(final byte[] bytes)
  5. toHexFromOct(final String octSymbols)
  6. toHexLiteral(int v)
  7. toHexN(long src, int hexn)
  8. ToHexNumber(int c)
  9. toHexOrNegative(int i)