Java - Write code to check if an array of char Contains a char

Requirements

Write code to check if an array of char Contains a char

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        char[] array = new char[] { 'b', 'o', 'o', 'k', '2', 's', '.', 'c',
                'o', 'm', 'a', '1', };
        char charToFind = 'a';
        System.out.println(arrayContains(array, charToFind));
    }/*from w  w  w  .  java 2s  . com*/

    private static boolean arrayContains(char[] array, char charToFind) {
        for (char c : array) {
            if (c == charToFind)
                return true;
        }
        return false;
    }
}