Here you can find the source of getArrayIntersection(int a[], int b[])
public static int[] getArrayIntersection(int a[], int b[])
//package com.java2s; //License from project: Apache License import java.util.Arrays; public class Main { public static int[] getArrayIntersection(int a[], int b[]) { return Arrays.stream(a).flatMap(i -> Arrays.stream(b).filter(j -> i == j)).distinct().toArray(); }//from w w w . j a v a2s . c om }