ArrayList<Integer> number = new ArrayList<Integer>(); 

// add numbers to arraylist
number.add(1);
number.add(2);
number.add(7);
number.add(5);

// find hashcode before being sorted
System.out.println("hashCode before: " + number.hashCode());

// sort arraylist in reverse order, swap first and last elements
Collections.sort(number, Collections.reverseOrder());
Collections.swap(number, 0, 3);
System.out.println(number);

//find hashcode after being sorted
System.out.println("hasCode after: " + numbers.hashCode());
hashCode before: 955456
[1, 5, 2, 7]
hasCode after: 32