Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

intersection of two arrays java

 public static void findIntersection(int arry1[],int arry1size,int arry2[],int arry2size){
    	HashSet<Integer> hs=new HashSet<Integer>();
    	for(int i=0;i<arry1size;i++){
    		for(int j=0;j<arry2size;j++){
    			if(arry1[i]==arry2[j]){
    				hs.add(arry1[i]);
    			}
    		}
    	}
    	
    	System.out.println(hs);
    }
 
PREVIOUS NEXT
Tagged: #intersection #arrays #java
ADD COMMENT
Topic
Name
5+2 =