Java tutorial
//package com.java2s; public class Main { public static String byteArray2HexString(byte[] bytes) { if (null == bytes) { return ""; } StringBuilder hexString = new StringBuilder(); for (byte b : bytes) { String str = Integer.toHexString(0xFF & b); while (str.length() < 2) { str = "0" + str; } hexString.append(str); } return hexString.toString(); } }