Thanks
public class duplicate {
int temp, true_count;
int ar[] = { 1, 2, 3, 4, 1 };
int count;
public void find() {
for (int i = 0; i < ar.length - 1; i++) {
temp = ar[i];
for (int j = i; j <= ar.length-1 ; j++) {
if (temp == ar[j]) {
count += 1;
}
}
}
}
public static void main(String args[]) {
duplicate dup = new duplicate();
dup.find();
System.out.println("The No of duplicates is :" + dup.count);
}
}