Removing the first 16 bytes from a byte array
See Arrays
class in the Java library:
Arrays.copyOfRange(byte[] original, int from, int to)
from
is inclusive, whereas to
is exclusive. Both are zero based indices, so to remove the first 16 bytes do
Arrays.copyOfRange(original, 16, original.length);
byte[] a;
...
if(a.length > 1) {
byte[] newA = new byte[a.length-2];
for(int i = 2; i < a.length; ++i)
newA[i-2]=a[i];
}