Wrong output & how to pass a array by reference

the output coming in this different from the actual output i have checked from my end tried both sorting in same and different function and how we can pass a array using reference

@dd090102_d0e70f0132b9b388 Refer this arctice : https://www.digitalocean.com/community/tutorials/java-is-pass-by-value-and-not-pass-by-reference