<p>To convert hex string to byte array, you need to first get the length of the given string and include it while creating a new byte array.</p><pre class="result notranslate">byte[] val = new byte[str.length() / 2];</pre><p>Now, take a for loop unti</p>