Java Arrays search element via Stream filter()
import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; public class Main { public static void main(String[] args) { Integer[] values = {12, 19, 5, 10, 3, 17, 1, 4, 8, 6}; // values greater than 4 List<Integer> list = Arrays.stream(values)//from ww w .j a v a 2s . c o m .filter(value -> value > 4) .collect(Collectors.toList()); System.out.printf("Values greater than 4: %s%n", list); } }