Java passes all arguments by value.
This means that the arr variable in your initArray method will refer to the same array that you pass to it in your main method, but it is a different variable from the arr variable in your main method.
You essentially pass the value null to it, then you assign a new array to arr in initArray, which is a different variable from arr in your main method, so nothing happens to your main method variable.
Instead, you could do something like this: