Here you can find the source of bytesToHex(byte[] raw)
public static String bytesToHex(byte[] raw)
//package com.java2s; //License from project: Open Source License public class Main { private static final String HEXES = "0123456789ABCDEF"; public static String bytesToHex(byte[] raw) { final StringBuilder hex = new StringBuilder(2 * raw.length); for (final byte b : raw) hex.append(HEXES.charAt((b & 0xF0) >> 4)).append(HEXES.charAt((b & 0x0F))); return hex.toString(); }/* ww w . ja va2 s .c o m*/ }