Check out example codes for "how to check if in array java". It will help you in understanding the concepts better.

Code Example 1

for (int element : arr) {
    if (element == toCheckValue) {
        return true;
    }
}

Learn ReactJs, React Native from akashmittal.com