Java tutorial
//package com.java2s; public class Main { public static String toHexString(byte[] bytes, String pad) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { sb.append(String.format("%02x%s", bytes[i], pad)); } return sb.toString(); } }