import java.util.*;
public class demo1
{
public static void main(String[] args)
{
int[] array = {2,4,5,7,5,4,2,1,3,7};
for (int a = 0; a < array.length-1; a++)
{
for (int b = a+1; b < array.length; b++)
{
if ((array[a] == array[b]) && (a != b))
{
System.out.println("Duplicate Element : "+array[b]);
}
}
}
}
}Java
Program to find the duplicate values of an array.

Written by
View ProfileNikhil Juneja
Passionate software developer and technical contributor at TutorialsLink.
