1.首先定义一个接口
package temp.test;public interface IntCompare { public int compare(int a, int b);}
2.分别定义两个接口实现类,一个增序,一个减序
增序:
package temp.test;public class IncreaseOrder implements IntCompare{ @Override public int compare(int a, int b) { // TODO Auto-generated method stub if(a>b){ return -1; }else if(a<b></p><p> 降序:</p>4.测试结果
1234554321