Here you can find the source of ToBase16(StringBuilder str, byte[] data)
public static void ToBase16(StringBuilder str, byte[] data)
//package com.java2s; public class Main { private static final String HexAlphabet = "0123456789ABCDEF"; public static void ToBase16(StringBuilder str, byte[] data) { if (data == null) { throw new NullPointerException("data"); }//from ww w . j av a2s. c o m int length = data.length; for (int i = 0; i < length; ++i) { str.append(HexAlphabet.charAt((data[i] >> 4) & 15)); str.append(HexAlphabet.charAt(data[i] & 15)); } } }