java
空指针public static void main(String args[]){
File[] f=new File[5];
f[0]=new File("C:\\Users\\阳光快车\\Documents\\MyJob\\1演示文件\\新数据\\直井A.xls");
f[1]=new File("C:\\Users\\阳光快车\\Documents\\MyJob\\1演示文件\\新数据\\直井B.xls");
f[2]=new File("C:\\Users\\阳光快车\\Documents\\MyJob\\1演示文件\\新数据\\直井C.xls");
f[3]=new File("C:\\Users\\阳光快车\\Documents\\MyJob\\1演示文件\\新数据\\直井D.xls");
f[4]=new File("C:\\Users\\阳光快车\\Documents\\MyJob\\1演示文件\\新数据\\直井E.xls");
CheckCeng a=new CheckCeng(f);
}
public class CheckCeng {
ReadJingName[] rjn;
List<Integer> list=new ArrayList<Integer>();
public CheckCeng(){
}
public CheckCeng(File[] ff){
rjn=new ReadJingName[ff.length];
System.out.println(ff.length);
for (int i = 0; i < ff.length; i++) {
int k=i;
System.out.println(ff[i]);
rjn[1].readFile(ff[i]);
list.add(rjn[i].cengMing.length);[/color]
}
findMostEL(list);
}
public int findMostEL(List<Integer> as){
// int [] intArry={3,5,7,8,3,5,5,3,7};
Map<Integer,Integer> m1=new HashMap<Integer,Integer>();
int max=0;
for(int i=0;i<as.size();i++){
if(m1.containsKey(as.get(i))){
if(m1.get(as.get(i))+1>max){
max=m1.get(as.get(i))+1;
}
m1.put(as.get(i), m1.get(as.get(i))+1);
}else{
m1.put(as.get(i), 1);
}
}
for(int i=0;i<m1.size();i++){
if(m1.get(as.get(i))==max){
System.out.println("最大值:"+as.get(i)+"出现了"+max+"次");