Java - Write code to check if a string contains None of the char in the char array

Requirements

Write code to check if a string contains None of the char in the char array

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String str = "book2s.com";
        char[] invalid = new char[] { 'b', 'o', 'o', 'k', '2', 's', '.',
                'c', 'o', 'm', 'a', '1', };
        System.out.println(containsNone(str, invalid));
    }/*from  w w  w .  j a v  a 2s . c o m*/

    public static boolean containsNone(String str, char[] invalid) {
        if ((str == null) || (invalid == null)) {
            return true;
        }

        int strSize = str.length();
        int validSize = invalid.length;

        for (int i = 0; i < strSize; i++) {
            char ch = str.charAt(i);

            for (int j = 0; j < validSize; j++) {
                if (invalid[j] == ch) {
                    return false;
                }
            }
        }

        return true;
    }

    public static boolean containsNone(String str, String invalidChars) {
        if ((str == null) || (invalidChars == null)) {
            return true;
        }

        return containsNone(str, invalidChars.toCharArray());
    }
}