private static void writeBytes(BufferedWriter bw, byte[] tab) throws IOException {

        for (int i = 0; i < tab.length; i++) {
            String val = Integer.toHexString(0x000000FF & tab[i]);
            if (val.length() < 2) {
                val = "0" + val;
            }
            bw.append(val);
        }
    }