In Java, how do I take a byte[] array and remove the first 16 bytes from the array? I know I might have to do this by copying the array into a new array. Any examples or hel
System.arraycopy() also can do that:
System.arraycopy()
public static byte[] truncate(byte[] bytes, int srcPos, int newLength) { if (bytes.length < newLength) { return bytes; } else { byte[] truncated = new byte[newLength]; System.arraycopy(bytes, srcPos, truncated, 0, newLength); return truncated; } }