Java tutorial
//package com.java2s; //License from project: Apache License public class Main { private static String bytesToHexString(byte[] bytes) { StringBuilder sb = new StringBuilder(); for (byte aByte : bytes) { String hex = Integer.toHexString(255 & aByte); if (hex.length() == 1) { sb.append('0'); } sb.append(hex); } return sb.toString(); } }