Java tutorial
//package com.java2s; public class Main { public static String bytesToHexString(byte[] bytes) { String result = ""; for (int i = 0; i < bytes.length; i++) { String hexString = Integer.toHexString(bytes[i] & 0xFF); if (hexString.length() == 1) { hexString = '0' + hexString; } result += hexString.toUpperCase(); } return result; } }