Java tutorial
//package com.java2s; public class Main { private static String bytesToHexString(byte[] bytes) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { String hex = Integer.toHexString(0xFF & bytes[i]); if (hex.length() == 1) { builder.append("0"); } builder.append(hex); } return builder.toString(); } }