/* * MyComparator.java * * */ import java.util.Comparator; /* the comparator between two integers */ public class MyComparator implements Comparator { public int compare(Object d1, Object d2) { int n1 = ((Integer)d1).intValue(); int n2 = ((Integer)d2).intValue(); if (n1 < n2) return -1; else if (n1==n2) return 0; else return 1; } }