OK, here's what I want to do (I realize the code below doesn't work, but it's what I would LIKE to do). I've converting things from C++
public void ChangePrimitiveArray(byte bytes[])
{
bytes[0] = 1;
}
public void foo()
{
byte bytes[] = new byte[2];
bytes[0] = 4;
ChangePrimitiveArray(bytes);
System.out.printf("bytes[0]=0x%02x\n", bytes[0]);
}
This displays 0x04, not 0x01. It needs to display 0x01. Any ideas? The real function is more involved than this, but this shows the problem. Do I need to convert things from an array to an ArrayList or something or can I stick with plain old arrays? And is it because byte is a primitive type?