public class Exercise {
public static void main(String[] args) {
Paper[] p = new Paper[7];
Paper p1 = new Paper();
Paper p2 = new Paper();
Paper p3 = new Paper();
Paper p4 = new Paper();
Paper p5 = new Paper();
Paper p6 = new Paper();
Paper p7 = new Paper();
for (int i = 0; i < p.length; i++) {
System.out.println(p[i].hashCode());
}
System.out.println("-------------");
for (int i = 0; i < p.length-1; i++) {
for (int j = 0; j < p.length-i-1; j++) {
if(p[j].compareTo(p[j+1])){
Paper pa = p[j];
p[j]=p[j+1];
p[j+1]=pa;
}
}
}
for (int i = 0; i < p.length; i++) {
System.out.println(p[i].hashCode());
}
}
}
class Paper {
public boolean compareTo(Paper p){
return hashCode()-p.hashCode()>0;
}