Here you can find the source of byteArrayToHex(final byte[] hash)
Parameter | Description |
---|---|
hash | a parameter |
public static String byteArrayToHex(final byte[] hash)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.util.Formatter; public class Main { /**//from www . j av a2 s. com * Get the hex string representation of a given byte array * * @param hash * @return */ public static String byteArrayToHex(final byte[] hash) { String result; Formatter formatter = new Formatter(); try { for (byte b : hash) { formatter.format("%02x", b); } result = formatter.toString(); } catch (Exception lEx) { throw new RuntimeException(lEx); } return result; } }