code: public static boolean containsConstant(final Enum<?>[] enumValues, final String constant,
        final boolean caseSensitive) {
      for (final Enum<?> candidate : enumValues) {
        if (caseSensitive ? candidate.toString().equals(constant)
            : candidate.toString().equalsIgnoreCase(constant)) {
          return true;
        }
      }
      return false;
    }
docs: Check whether the given array of enum constants contains a constant with the given name.
  
  @param enumValues the enum values to check, typically the product of a call to MyEnum.values()
  @param constant the constant name to find (must not be null or empty string)
  @param caseSensitive whether case is significant in determining a match
  @return whether the constant has been found in the given array