Here you can find the source of bytes2hex(byte[] binput)
public static String bytes2hex(byte[] binput)
//package com.java2s; // it under the terms of the GNU General Public License as published by public class Main { private static char[] HEXCHARS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; public static String bytes2hex(byte[] binput) { StringBuffer s = new StringBuffer(binput.length * 2); for (int i = 0; i < binput.length; i++) { byte b = binput[i]; s.append(HEXCHARS[(b & 0xF0) >> 4]); s.append(HEXCHARS[b & 0x0F]); }// w w w . j a va 2 s. co m return s.toString(); } }