Here you can find the source of toHex(byte[] raw)
private static String toHex(byte[] raw)
//package com.java2s; //License from project: Apache License public class Main { private static final char[] HEXES = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; private static String toHex(byte[] raw) { if (raw.length != 16) throw new IllegalArgumentException("length must be 16, not " + raw.length); final char[] hex = new char[32]; short i = 0; for (final byte b : raw) { hex[i] = HEXES[(b & 0xF0) >> 4]; hex[i + 1] = HEXES[(b & 0x0F)]; i += 2;/* w ww.j a v a 2 s. c o m*/ } return new String(hex); } }