You can use ArrayUtils.containsArrayUtils.contains from Apache Commons LangApache Commons Lang
public static boolean contains(Object[] array, Object objectToFind)public static boolean contains(Object[] array, Object objectToFind)
Note that this method returns false if the passed array is null.
There are also methods available for primitive arrays of all kinds.
Example:
String[] fieldsToInclude = { "id", "name", "location" }; if ( ArrayUtils.contains( fieldsToInclude, "id" ) ) { // Do some stuff. }