Hi, I have two arrays that contain integers. I want to create a new array with only integers that exist in two other arrays. Is there a simple way to do this? I can either create a new array or erase items from one of the arrays if it does not exist in the other. Thanks!
It sounds like you want to find the intersection of two sets, right? You could do that easily enough with java.util.Set<Integer>. Most of the fiddling would involve converting this set back to a int. Do you have to work with arrays?