I wrote below code to compare to arrays that have same elements but in diff order.
Integer arr1[] = {1,4,6,7,2}; Integer arr2[] = {1,2,7,4,6};
If you have no duplicates you can turn the arrays into sets:
new HashSet(Arrays.asList(arr1)) .equals(new HashSet(Arrays.asList(arr2)))
Otherwise:
List l1 = new ArrayList(Arrays.asList(arr1)); List l2 = new ArrayList(Arrays.asList(arr1)); Collections.sort(l1); Collections.sort(l2); l1.equals(l2);