Java Hex Calculate toHexadecimal(byte[] digest)

Here you can find the source of toHexadecimal(byte[] digest)

Description

Convierte un arreglo de bytes a String usando valores hexadecimales

License

Open Source License

Parameter

Parameter Description
digest arreglo de bytes a convertir

Return

String creado a partir de digest

Declaration

private static String toHexadecimal(byte[] digest) 

Method Source Code

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

public class Main {
    /***//from w  w  w  .j av  a2 s  .com
     * Convierte un arreglo de bytes a String usando valores hexadecimales
     * @param digest arreglo de bytes a convertir
     * @return String creado a partir de <code>digest</code>
     */
    private static String toHexadecimal(byte[] digest) {
        String hash = "";
        for (byte aux : digest) {
            int b = aux & 0xff;
            if (Integer.toHexString(b).length() == 1)
                hash += "0";
            hash += Integer.toHexString(b);
        }
        return hash;
    }
}

Related

  1. toHex4(int value)
  2. toHex8(long x)
  3. toHexa(byte[] bb)
  4. toHexAddress(long address)
  5. toHexaDecimal(byte[] bytesToConvert)
  6. toHexadecimal(byte[] digest)
  7. toHexadecimal(final byte[] array)
  8. toHexadecimal(final byte[] in)
  9. toHexadecimal(final byte[] message)