Java tutorial
//package com.java2s; public class Main { private static String convertToHexString(byte[] array) { StringBuilder hexStr = new StringBuilder(); for (int i = 0; i < array.length; ++i) { hexStr.append(Integer.toHexString((array[i] & 0xFF) | 0x100).substring(1, 3)); } return hexStr.toString(); } }