You could simply use ArrayUtils.contains
from Apache Commons Lang library.
public boolean contains(final int[] array, final int key) {
return ArrayUtils.contains(array, key);
}
More Related Contents:
- Java Array Sort descending?
- How to convert a Byte Array to an Int Array
- Splitting String and put it on int array
- Using contains on an ArrayList with integer arrays
- How can I convert a Java HashSet to a primitive int array?
- int[] and Integer[] arrays – What is the difference?
- Converting an int array to a String array
- JAVA ArrayIndexoutofBoundException issue
- Write a program that takes an array/arraylist of integer and finds longest sub array/arraylist whose entries are equal [closed]
- Difference between int[] array and int array[]
- How to split a String by space
- NullPointerException when Creating an Array of objects [duplicate]
- How to convert object array to string array in Java
- How to return an array from JNI to Java?
- How to parse JSON Array (Not Json Object) in Android
- What does an integer that has zero in front of it mean and how can I print it?
- Find the most popular element in int[] array
- How does the Java array argument declaration syntax “…” work?
- Write a mode method in Java to find the most frequently occurring element in an array
- How to clone a multidimensional array in java? [duplicate]
- How to access nested elements of json object using getJSONArray method
- Why can I edit the contents of a final array in Java?
- How to manipulate arrays. Find the average. Beginner Java
- Time Complexity for Java ArrayList
- How to deep copy an irregular 2D array
- java: Arrays.sort() with lambda expression
- add an element to int [] array in java [duplicate]
- Finding prime numbers with the Sieve of Eratosthenes (Originally: Is there a better way to prepare this array?)
- How to remove element from an array
- Error of int cannot be dereferenced?