Java tutorial
//package com.java2s; import java.util.Formatter; public class Main { public static String byteArrayToHexString(byte[] paramArrayOfByte) { StringBuilder localStringBuilder = new StringBuilder(2 * paramArrayOfByte.length); Formatter localFormatter = new Formatter(localStringBuilder); int i = paramArrayOfByte.length; for (int j = 0; j < i; j++) { byte b = paramArrayOfByte[j]; Object[] arrayOfObject = new Object[1]; arrayOfObject[0] = Byte.valueOf(b); localFormatter.format("%02x", arrayOfObject); } localFormatter.close(); return localStringBuilder.toString(); } }