public static void writeFixedLengthBytes(byte[] data, int index, int length, ByteArrayOutputStream out) {
        for (int i = index; i < index + length; i++) {
            out.write(data[i]);
        }
    }
@Test
	public void testWriteFixedLengthBytes() {
		ByteArrayOutputStream out = new ByteArrayOutputStream();
		ByteHelper.writeFixedLengthBytes(new byte[] {1, -128, 2, 0, 0}, 2, 3, out);

		Assert.assertArrayEquals(new byte[] {2, 0, 0}, out.toByteArray());
	}