We can use a Stream to check whether an array contains specific int, long or double values.
For this solution, we have to import IntStream library.
import java.util.stream.IntStream;
Following is the solution to find a specific integer value.
public static void main(String[] args) {
int[] a = {1,2,3,4};
boolean result = IntStream.of(a).anyMatch(x -> x == 5);
System.out.println(result);
}
}
Output is:
false