Java Hex Calculate toHexString(byte[] md)

Here you can find the source of toHexString(byte[] md)

Description

to Hex String

License

Open Source License

Declaration

private static String toHexString(byte[] md) 

Method Source Code

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

public class Main {
    private static String toHexString(byte[] md) {
        char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
        int j = md.length;
        char str[] = new char[j * 2];
        for (int i = 0; i < j; i++) {
            byte byte0 = md[i];
            str[2 * i] = hexDigits[byte0 >>> 4 & 0xf];
            str[i * 2 + 1] = hexDigits[byte0 & 0xf];
        }//from   w  w w  .  j a v  a 2  s  .c om
        return new String(str);
    }
}

Related

  1. toHexString(byte[] digest)
  2. toHexString(byte[] digest)
  3. toHexString(byte[] digestByte)
  4. toHexString(byte[] in)
  5. toHexString(byte[] input)
  6. toHexString(byte[] messagePayload)
  7. toHexString(byte[] paramArrayOfByte)
  8. toHexString(byte[] paramArrayOfByte, String paramString, boolean paramBoolean)
  9. toHexString(byte[] raw)