Here you can find the source of toString(byte[] theByteArray)
public static String toString(byte[] theByteArray)
//package com.java2s; //License from project: LGPL public class Main { public static String toString(byte[] theByteArray) { StringBuffer out = new StringBuffer(); for (int i = 0; i < theByteArray.length; i++) { String s = Integer.toHexString(theByteArray[i] & 0xff); if (s.length() < 2) { out.append('0'); }// ww w.j ava 2 s. c om out.append(s).append(' '); } return out.toString(); } }