*
* @author Administrator
*/
import java.text.*;
public class Main {
public static void main(String[] args){
/*Shape[] shape1={new Circle(2.0),new Circle(3.0),new Circle(4.0),
new Circle(5.0),new Circle(6.0)};
Shape[] shape2={new Rectangle(1.0,2.0),new Rectangle(2.0,3.0),new Rectangle(3.0,4.0),
new Rectangle(4.0,5.0),new Rectangle(5.0,6.0)};
Shape shape3=new Circle(6.0);
Shape shape4=new Rectangle(10.0,10.0);*/
Shape[] shape1={new Circle(1.1),new Circle(1.2),new Circle(1.3),
new Circle(1.4),new Circle(1.5)};
Shape[] shape2={new Rectangle(1.0,4.0),new Rectangle(7.0,3.0),new Rectangle(3.0,5.0),
new Rectangle(9.0,5.0),new Rectangle(5.0,4.0)};
Shape shape3=new Circle(2.0);
Shape shape4=new Rectangle(9.5,5.0);
System.out.print("【排序面积从小到大】:\n");
sort(shape1);
sort(shape2);
System.out.print("【圆形数组】【长度】"+shape1.length);
for(int i=0;iSystem.out.println("【位置】"+i+shape1[i].toString());
}
System.out.println("【矩形数组】【长度】"+shape2.length);
for(int i=0;iSystem.out.println("【位置】"+i+shape2[i].toString());
}
int index=BinarySearch(shape1,shape3);
System.out.println("\n【二分法查找】:");
if(index==0){
System.out.println("【对象】"+shape3.toString()+"不存在【圆形】数组中。");
}
else{
System.out.println("【对象】"+shape3.toString()+