Java tutorial
//package com.java2s; import java.util.Locale; public class Main { public static String bytesToHexString(byte[] src) { if (src == null || src.length <= 0) { return null; } String hexStr = ""; for (byte b : src) { String hex = Integer.toHexString(b & 0xFF); if (hex.length() == 1) { hex = '0' + hex; } hexStr += hex.toUpperCase(Locale.getDefault()); } return hexStr; } }