Java - Write code to check if a a string has non-ASCII digits

Requirements

Write code to check if a a string has non-ASCII digits

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String line = "book2s.com";
        System.out.println(containsNonASCII(line));
    }//w  w w.  j  a v  a 2 s.  co  m

    /**
     * A small helper method to find non-ASCII digits in a String.
     * @param line The String to scan.
     * @return true if there was a non-ASCII digit found in the line.
     */
    public static boolean containsNonASCII(String line) {
        int[] charArr = new int[line.length()];
        for (int i = 0; i < line.length(); i++)
            charArr[i] = line.codePointAt(i);
        for (int c : charArr) {
            if ((c >= 1 && c <= 9) || c == 11 || c == 12
                    || (c >= 14 && c <= 31) || c >= 127) {
                return true;
            }
        }
        return false;
    }
}