An easy way to go about this is to convert each array into a Set, and then use Set#retainAll to determine equality.
int[] a = {1, 2, 3, 4, 5}; int[] b = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; Set<Integer> A = Arrays.stream(a).boxed().collect(Collectors.toSet()); Set<Integer> B = Arrays.stream(b).boxed().collect(Collectors.toSet()); B.retainAll(A); System.out.println(B.equals(A)); This will print true if every element in A is in B, otherwise false.