How do I determine whether an array contains a particular value in Java?
Warning: this doesn’t work for arrays of primitives (see the comments). Since java-8 you can now use Streams. To check whether an array of int, double or long contains a value use IntStream, DoubleStream or LongStream respectively. Example