You are almost there,
1. One mistake, when the first duplicate found, => c=2
2. Once the first pair found, start a loop to count the remaining duplicates.
Insert the following code to your original one:
if(a[i] == a[j])
{
System.out.println(a[i]);
c = 2;
for(int k = j+1; k < a.length; k++){
if(a[j] == a[k]){
c++;
}
}
break outerloop;