public static ArrayList<Integer> inorderTraversal3(TreeNode root) {
    	ArrayList<Integer> list =new ArrayList<Integer>();
        if(root == null) return list;
        Stack<TreeNode> stack = new Stack<TreeNode>();
        TreeNode node = root;
        while(node != null){
        	stack.push(node);
        	node = node.left;
        }
        while(!stack.isEmpty()){
        	TreeNode cur = stack.pop();
        	list.add(cur.val);
        	if(cur.right != null){
        		cur = cur.right;
        		stack.push(cur);
        		while(cur.left != null){
        			cur = cur.left;
        			stack.push(cur);
        		}
        	}
        }
        return list;
    }