public boolean validNum(String s) {
        if(s.length() == 0) return false; // bug, need to check here
    	if(s.charAt(0) == '+' || s.charAt(0) == '-') s = s.substring(1);
    	if(s.contains(".")) {
    		int index = s.indexOf('.');
    		// s.length() > 1 to guarantee no "."
    		return s.length() > 1 && validInt(s.substring(0, index), true, false) 
    		        && validInt(s.substring(index + 1, s.length()), true, false);
    	} else {
    	    // s.length() > 0 to guarantee no "+" / "-"
    		return s.length() > 0 && validInt(s, true, false);
    	}
    }