Java, how to get a collection of byte from a byte array
<p>This question may seems unique but I am having difficulties on solving it.</p>

<p>I have a byte array (a DW per row) and trying to get the byte value for every 9 bytes.
Here is how the byte array looks like:</p>

<pre><code>0   1   2   3
4   5   6   7
8|  9   10  11
12  13  14  15
16  17| 18  19
20  21  22  23
24  25  26| 27
28  29  30  31
32  33  34  35|
.......
</code></pre>

<p>Here is a defined function that I need to use to get the value from the above patent:</p>

<pre><code>getValue(int DWOffset, int highBit, int lowBit)

//DWOffset indicates the row of the data.
//highBit indicates the ending bit
//lowBit indicates the starting bit
</code></pre>

<p>My question is how to get every 9 bytes from the data (where the | appears) by using for loop? The data length can be found out by using</p>

<pre><code>data.getLength();    //which returns the total number of bytes in the data
</code></pre>

<p>So far, I can get value on the first two row:</p>

<pre><code>for(int i = 0; i &lt; data.getLength()/(4*2); i++){
    getValue(i*2, 31, 0);         //DW i
    getValue(i*2 + 1, 31, 0);     //DW i+1
} 
</code></pre>