Here you can find the source of toHex(byte[] v)
public final static String toHex(byte[] v)
//package com.java2s; //License from project: Open Source License public class Main { private static char[] hex = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; public final static String toHex(byte[] v) { String out = ""; for (int i = 0; i < v.length; i++) out = out + hex[(v[i] >> 4) & 0xF] + hex[v[i] & 0xF]; return (out); }// w ww. ja v a2s . c o m }