public static void main(String[] args) {
// TODO Auto-generated method stub
int []arr={1, 1, 1, 1, 3, 3, 3, 4, 5, 2 ,6, 6, 6, 6, 6};
int[]hasArray=new int[arr.length+1];
int maxLength=0;
for(int i=0;i<arr.length;i++)
{
hasArray[arr[i]%hasArray.length]+=1;
maxLength=hasArray[arr[i]%hasArray.length]>maxLength?hasArray[arr[i]%hasArray.length]:maxLength;
}
while(maxLength>=1)
{
for(int i=0;i<arr.length;i++)
{
if(hasArray[arr[i]%hasArray.length]==maxLength)
{
System.out.print(arr[i]%hasArray.length+"
");
}
}
maxLength--;
}
}