Answers for "algorithm to find the duplicate numbers on the integer array in java?"

3

find duplicate value in array using java

public class DuplicateArrayElement {
  public static void main(String[] args) {
    int[] numArray = {2, 6, 7, 6, 2, 19, 1, 19};
    for(int i = 0; i < numArray.length; i++){
      for(int j = i + 1; j < numArray.length; j++){
        if(numArray[i] == numArray[j]){
          System.out.println("Duplicate element found " + numArray[j]);
        }
      }
    }    
  }
}
Posted by: Guest on December-17-2021

Code answers related to "algorithm to find the duplicate numbers on the integer array in java?"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language