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