Java is pass-by-reference-value when passing non-primitive arguments to methods, and is pass-by-value when passing primitives, meaning that if you have a byte array and you pass it to a modification method, that object will be modified.
Example:
public static void main(String[] args) {
byte[] arr = new byte[10];
for (int i = 0; i < arr.length; i++) {
arr[i] = i;
}
// arr now contains { 0, 1, 2, 3, ... 9 }
System.out.println(Arrays.toString(arr));
randomize(arr);
// arr now contains (ex.) { 6, 3, 7, 1, 9, 3, 2, 6, 3, 0 }
System.out.println(Arrays.toString(arr));
}
public void randomize(byte[] arr) {
Random random = new Random();
for (int i = 0; i < arr.length; i++) {
arr[i] = random.nextInt(10);
}
}