Here you can find the source of toHexString(byte[] arr)
public static String toHexString(byte[] arr)
//package com.java2s; //License from project: Open Source License public class Main { public static String toHexString(byte[] arr) { StringBuilder sb = new StringBuilder(); boolean first = true; sb.append('['); for (byte b : arr) { if (first) first = false;//from www. j ava 2 s.c o m else sb.append(','); String s = Integer.toHexString(b & 0xFF); if (s.length() == 1) sb.append('0'); sb.append(s); } sb.append(']'); return sb.toString(); } }