Checking if a string matches an array of valid characters
memory is surprisingly fast and efficient. If your string-to-test is even modestly large (like 1K), then you may find the following algorithm is efficient. This is especially efficient when the valid-character set is reusable....

boolean[] isvalid = new boolean[Character.MAX_VALUE + 1];
for (char c : VALID_CHARS) {
    isvalid[c] = true;
}
for (char c : name) {
    if (!isvalid[c]) {
       System.out.println("You failed!.");
       return;
    }
}
System.out.println("You succeeded!.");


Now, in your case, there is no reason why VALID_CHARS cannot be declared as:

private static final boolean[] VALIDCHARS = buildValidChars();
private static final boolean[] buildValidChars() {
    ....
}


I have used, and benchmarked this sort of system to great effect when building the JDOM Character validator... you can see how I did it there.... but using a bit-mask representation to use less memory.... which is a bit faster. I also put together a bit of a benchmarh and writeup for the JDOM Verifier performance.