Java tutorial
//package com.java2s; public class Main { /** * Transforms bytes to String * * @param data bytes * @return String */ public static String bytesToHex(byte[] data) { if (data == null) return null; String str = ""; for (byte aData : data) { if ((aData & 0xFF) < 16) str = str + "0" + Integer.toHexString(aData & 0xFF); else str = str + Integer.toHexString(aData & 0xFF); } return str; } }