Here you can find the source of bytes2HexString(byte[] data)
public static String bytes2HexString(byte[] data)
//package com.java2s; public class Main { private static final char[] DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; public static String bytes2HexString(byte[] data) { StringBuffer sb = new StringBuffer(32); for (byte b : data) { char low = DIGITS[b & 0x0F]; char high = DIGITS[(b & 0xF0) >>> 4]; sb.append(high);// ww w. ja v a 2 s. co m sb.append(low); } return sb.toString(); } }