You can use the one below. I tested this with leading zero bytes and with initial negative bytes as well
public static String toHex(byte[] bytes) {
BigInteger bi = new BigInteger(1, bytes);
return String.format("%0" + (bytes.length << 1) + "X", bi);
}
If you want lowercase hex digits, use "x" in the format String.