how to convert hex to byte for the following program?
<pre><code>public static String asHex (byte buf[]) {
    StringBuffer strbuf = new StringBuffer(buf.length * 2);
    int i;

    for (i = 0; i &lt; buf.length; i++) {
        if (((int) buf[i] &amp; 0xff) &lt; 0x10)
            strbuf.append("0");

        strbuf.append(Long.toString((int) buf[i] &amp; 0xff, 16));
    }

    return strbuf.toString();
}
</code></pre>
