Java tutorial
//package com.java2s; public class Main { private static String toHexString(byte[] bytes) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < bytes.length; i++) { sb.append(Integer.toHexString(bytes[i] >> 4 & 0x0f)).append(Integer.toHexString(bytes[i] & 0x0f)); } return sb.toString(); } }