Java tutorial
//package com.java2s; public class Main { public static String dumpBytesAsString(byte[] data) { final StringBuilder stringBuilder = new StringBuilder(data.length); for (byte byteChar : data) { stringBuilder.append(String.format("%02X ", byteChar)); } return stringBuilder.toString(); } }