Here you can find the source of tohex(byte[] arg)
public static String tohex(byte[] arg)
//package com.java2s; //License from project: Open Source License public class Main { public static String tohex(byte[] arg) { String res = ""; String a;//from w w w.j ava 2s . c o m for (int i = 0; i < arg.length; i++) { a = Integer.toHexString(((int) arg[i]) & 0xFF); if (a.length() == 1) a = "0" + a; res += a; } return res; } }