Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { /** * Return a hexadecimal string representation of a byte array. * * @param bytes byte[] * @return String */ public static String byteToHex(byte[] bytes) { StringBuilder bcdString = new StringBuilder(); for (Byte b : bytes) { bcdString.append(String.format("%02X ", b)); } return bcdString.toString().trim(); } }