1、交集
public static void main(String[] args) {
int[] array1 = {1,2,3,4,5,6}; int[] array2 = {2,3,4,8}; List<Integer> list = new ArrayList<Integer>(); for (int i = 0; i < array1.length; i++) { for (int j = 0; j < array2.length; j++) { if(array1[i]==array2[j]){ list.add(array1[i]); } } } for (int i = 0; i < list.size(); i++) { System.out.println(list.get(i)); } }