intersection of two arrays java

Solutions on MaxInterview for intersection of two arrays java by the best coders in the world

showing results for - "intersection of two arrays java"
Jorge
22 Apr 2017
1 public static void findIntersection(int arry1[],int arry1size,int arry2[],int arry2size){
2    	HashSet<Integer> hs=new HashSet<Integer>();
3    	for(int i=0;i<arry1size;i++){
4    		for(int j=0;j<arry2size;j++){
5    			if(arry1[i]==arry2[j]){
6    				hs.add(arry1[i]);
7    			}
8    		}
9    	}
10    	
11    	System.out.println(hs);
12    }