Read Hex binary data from file in android java
<p>i want to convert the hex data which are in file like (53 48 DA C8 00 04) to byte array.
how could i do it.i used below code but i am getting wrong byte array data :(</p>

<pre><code>private byte[] readBinaryFile(String fileName) throws IOException {
     File file = new File(fileName);
    InputStream input = new BufferedInputStream(new FileInputStream(file));


    ByteArrayOutputStream output = new ByteArrayOutputStream();

    for (int read = input.read(); read &gt;= 0; read = input.read())
        output.write(read);

    byte[] buffer = output.toByteArray();

    input.close ();
    output.close();

    return buffer;
</code></pre>

<p>}</p>
