Write a Java program to test if an array contains a specific value is there are not code example
Example: Check if an array contains an element java
import java.util.Arrays;
String[] array = {"Boto", "Nesto", "Lepta"};
String toSearch = "Nesto";
if (Arrays.toString(array).contains(toSearch)) {
}
String strArray = Array.toString(array);
if (strArray.contains(toSearch)) {
}
int[] numbers = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
int number = 5;
String checker = Arrays.toString(numbers);
if (checker.contains(Integer.toString(number)) {
}