Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

find duplicate value in array 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]);
        }
      }
    }    
  }
}
Source by www.netjstech.com #
 
PREVIOUS NEXT
Tagged: #find #duplicate #array #java
ADD COMMENT
Topic
Name
4+1 =