Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { public static String bytes2HexString(byte[] data) { if (data == null) { return null; } StringBuilder sb = new StringBuilder(2 * data.length); for (byte b : data) { int n = 0x00ff & b; if (n < 10) { sb.append("0"); } sb.append(Integer.toHexString(n)); } return sb.toString(); } }