Arrays are object in Java, when you use
==
you are looking for the same object instance of different names that point to the same memory location. To compare the equality of all elements in two objects (arrays in this case), you have to use
equals
. Change this
if(arr==arr_new)
to
if(Arrays.equals(arr, arr_new))