This article explains it better than I can.
You are correct that the called method can't do anything to nums or index that will be reflected in the main method
Hence index in the main method remains at 2, even though the method increments its version of it.
But remember that array and object variables are effectively pointers/references to memory.
Java passes the reference/pointer of the array to the method by Value.
The method can't make any changes that affect the value of nums in main.
But it CAN make changes to what nums is 'pointing at', and those changes will be reflected.