Java tutorial
//package com.java2s; public class Main { /** * Converts a byte[] to a hex string * * @param byteArray Array to be converted * @return Array as a hex string */ public static String byteArrayToHexString(byte[] byteArray) { final StringBuilder builder = new StringBuilder(); for (byte b : byteArray) { builder.append(String.format("%02x", b)); } return builder.toString(); } }