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