In Java I can import java.util.function.IntPredicate; and use a ready-made solution for example
java.util.function.IntPredicate;
public boolean satisfies(IntPredicate p) {