Here you can find the source of toHexadecimal(final byte[] in)
public static String toHexadecimal(final byte[] in)
//package com.java2s; //License from project: Apache License public class Main { public static String toHexadecimal(final byte[] in) { return toHexadecimal(in, 0, in.length); }/*www. j a v a2s .c o m*/ public static String toHexadecimal(byte[] in, int ini, int len) { final StringBuffer sb = new StringBuffer(); char c; final int limit = (ini + len < in.length ? ini + len : in.length); for (int i = ini; i < limit; i++) { // First nibble c = (char) ((in[i] >> 4) & 0xf); if (c > 9) { c = (char) ((c - 10) + 'a'); } else { c = (char) (c + '0'); } sb.append(c); // Second nibble c = (char) (in[i] & 0xf); if (c > 9) { c = (char) ((c - 10) + 'a'); } else { c = (char) (c + '0'); } sb.append(c); } return sb.toString(); } }