public class PosStcInfo implements Comparable{ private double x;
private double y;
private int count=0;
@Override
public int compareTo(Object o) {
int res=1;
if(o instanceof PosStcInfo){
PosStcInfo other=(PosStcInfo)o;
res=this.count>other.count?1:(this.count<other.count?-1:0);
}
return res;
}
public PosStcInfo centerAt (List<PosStcInfo> list){
PosStcInfo max=null;

if(list.size()>0)
max= list.get(0);

Map <String,PosStcInfo> map = new HashMap<String, PosStcInfo>();
for(int i=0;i<list.size();i++){
PosStcInfo pos = list.get(i);
String x1 = String.valueOf(pos.x);
String y1 = String.valueOf(pos.y);
String str = x1.substring(0,5)+":"+y1.substring(0,4);
PosStcInfo old=map.get(str);
if(null==old){
pos.count=1;
map.put(str, pos);
old=pos;
//System.out.println(old.x+","+old.count+"1111");
}else{
old.count++;
}
//max.count<old.count
int num = max.compareTo(old);
System.out.println(num);
if(max.compareTo(old)<0)
max=old;
}
return max;
}
我想把这段代码写到JSP里面该怎么写呀?