001package headfirst.templatemethod.sort;
002
003import java.util.Arrays;
004
005public class DuckSortTestDrive {
006
007        public static void main(String[] args) {
008                Duck[] ducks = {
009                                new Duck("Daffy", 8),
010                                new Duck("Dewey", 2),
011                                new Duck("Howard", 7),
012                                new Duck("Louie", 2),
013                                new Duck("Donald", 10),
014                                new Duck("Huey", 2)
015                };
016
017                System.out.println("Before sorting:");
018                display(ducks);
019
020                Arrays.sort(ducks);
021
022                System.out.println("\nAfter sorting:");
023                display(ducks);
024        }
025
026        public static void display(Duck[] ducks) {
027                for (int i = 0; i < ducks.length; i++) {
028                        System.out.println(ducks[i]);
029                }
030        }
031}