Reading hex string blocks from a file and putting them into an array in java
<p>I want to read the a file where packets are stored as hex files and store them in arrays. For example, the there are three blocks here and I need to store them in 3 separate arrays. The arrays should contain these hex strings. Could someone please advice me the way to do it correctly? I tried using buffered reader and a string buffer but could not implement properly as each block needs to be put in different arrays.</p>

<p>00 04 75 8d 49 c7 00 01 03 cd 50 3c 08 00 45 00
00 30 07 28 40 00 80 06 00 00 c0 a8 ec 20 c0 a8
ec 1e 04 05 00 17 aa a2 9e b3 00 00 00 00 70 02
fa f0 e1 2b 00 00 02 04 05 b4 01 01 04 02</p>

<p>00 01 03 cd 50 3c 00 01 03 dd 4c 2d 08 00 45 00
00 30 00 00 40 00 40 06 e1 37 c0 a8 ec 1e c0 a8
ec 20 00 17 04 05 aa 5a b0 04 aa a2 9e b4 70 12
16 d0 6a dc 00 00 02 04 05 b4 01 01 04 02</p>

<p>00 04 75 8d 49 c7 00 01 03 cd 50 3c 08 00 45 00
00 28 07 29 40 00 80 06 00 00 c0 a8 ec 20 c0 a8
ec 1e 04 05 00 17 aa a2 9e b4 aa 5a b0 05 50 10
fa f0 59 ab 00 00</p>

<p>I have done up to this, but could not get it in the way I want. Especially I want to differentiate each blocks. </p>

<pre><code>    BufferedReader br=null;
    try{
    br = new BufferedReader(new FileReader(cmd));
    StringBuffer sb = new StringBuffer();
    String line;
            while((line = br.readLine())!= null)
            {
            sb.append(line);
            }
    String [] store = sb.toString().split(" ");
    pkt = store;
    }catch(IOException ie) {ie.printStackTrace();}
</code></pre>
