import java.util.Arrays;
public class SearchMax
{
public static void max(int i[])
{
//int maxvalue=0;
int count=0;
int countm=0;
//boolean printnum=false;
/*for(int j=0;j<i.length;j++)//找出最大数
{
if(maxvalue<=i[j])
{
maxvalue=i[j];
}
}//for */
if (i == null || i.length == 0)
throw new IllegalArgumentException("Parameter array should not be NULL");
int[] j=new int[i.length];
int t;
for (int n=0;n<i.length;n++)
{
j[n]=i[n];
}
Arrays.sort(j);
for (int m=j.length-1;m>=0;m--){
if (m<j.length-1 && j[m]==j[m+1]) continue;
System.out.println("数组最大数:"+j[m]);
countm++;
for(int k=0;k<i.length;k++)
{
if(j[m]==i[k])
{
System.out.println("数组的第" + countm +"个最大数的下标为:"+k);//找出最大数的位置
count++;
}
}
System.out.println("数组的第" + countm +"个最大数出现的次数:"+count);//最大数出现的次数
count=0;
}
}
public static void main(String args[])
{
int s[]={6,7,5,6,4,7,8,8};
max ;
}
}