public int atoi(String str) {
    	if (str == null || "".equals(str.trim())) return 0;
    	str = filter(str);
    	if (str.length() == 0) return 0;
    	boolean negtive = (str.charAt(0) == '-');
    	str = str.substring(1);
    	if (overfloor(str, negtive)) 
    	{
    		if (negtive) return Integer.MIN_VALUE;
    		else return Integer.MAX_VALUE;
    	}
    	int k = negtive ? -1 : 1;
    	int rst = 0;
    	int i =0;
    	while (i < str.length())
    	{
    		rst = rst * 10 +  k * (str.charAt(i) - '0');
    		i++;
    	}
    	return rst;
    }