class Hexer {

    public static String hexify(byte[] data) {
        StringBuffer hex = new StringBuffer();

        for (int i = 0; i < data.length; i++) {
            int highBits = ((int) data[i] & 0x000000F0) >> 4;
            int lowBits = ((int) data[i] & 0x0000000F);
            hex.append(hexChars[highBits]).append(hexChars[lowBits]);
        }

        return (hex.toString());
    }

}