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