Write a program which print duplicate number from Array in java?
package javatute; public class ShowsDuplicateNumber { public static void main(String[] args) { int arr[] = { 4, 2, 4, 5, 2, 3, 1 }; int size = arr.length; int i, j; System.out.println("duplicate Elements are :"); for (i = 0; i < size; i++) { for (j = i + 1; j < size; j++) { if (arr[i] == arr[j]) System.out.print(arr[i] + " "); } } } }