Here you can find the source of hexEncode(byte[] data)
public static String hexEncode(byte[] data)
//package com.java2s; public class Main { private static final char[] HEXCHARS = "0123456789abcdef".toCharArray(); public static String hexEncode(byte[] data) { StringBuffer r = new StringBuffer(); for (int i = 0; i < data.length; i++) { byte v = data[i]; r.append(HEXCHARS[(v >> 4) & 0xf]).append(HEXCHARS[v & 0xf]); }// w ww . j a v a 2s . c o m return r.toString(); } }