import java.util.Random; import java.util.Arrays; class SortRectangleArray { public static void main(String []args) { Random rand = new Random(12345); Rectangle []rectangles = new Rectangle[5]; for(int i=0;i<5; i++) rectangles[i] = new Rectangle(rand.nextInt(10), rand.nextInt(10)); print_rectangles(rectangles); Arrays.sort(rectangles, new RectangleComparator()); print_rectangles(rectangles); } public static void print_rectangles(Rectangle []rectangles) { System.out.println("================"); for(int i=0; i