public boolean validInt(String s, boolean validEmpty, boolean hasSign) {
        if(s.length() == 0) return validEmpty; // bug, .1 and 3. is allowed...
        if(hasSign) {
            if(s.charAt(0) == '+' || s.charAt(0) == '-') s = s.substring(1);
            if(s.length() == 0) return false; // bug, "6e+"
        }
        for(int i = 0; i < s.length(); i++) {
        	char ch = s.charAt(i);
        	if(!(ch >= '0' && ch <= '9')) return false; 
        }
        return true;
    }