public static TreeNode<Integer> mirror(TreeNode<Integer> t) {
		if (t == null) {
			return null;
		}
		
		if(t.left == null){
			return t;
		}
		
		TreeNode<Integer> root = t;
		TreeNode<Integer> left = t.left;

		Stack<TreeNode<Integer>> leftStack = new Stack<TreeNode<Integer>>();
		Stack<TreeNode<Integer>> rightStack = new Stack<TreeNode<Integer>>();

		TreeNode<Integer> right = new TreeNode<Integer>(left.data);
		leftStack.push(left);
		rightStack.push(right);

		while (leftStack.size() != 0) {
			TreeNode<Integer> oldNode = leftStack.pop();
			TreeNode<Integer> newNode = rightStack.pop();

			/* create a mirror of left */
			if (oldNode.left != null) {
				newNode.right = new TreeNode<Integer>(oldNode.left.data);
				leftStack.push(oldNode.left);
				rightStack.push(newNode.right);
			}

			/* create a mirror of right */
			if (oldNode.right != null) {
				newNode.left = new TreeNode<Integer>(oldNode.right.data);
				leftStack.push(oldNode.right);
				rightStack.push(newNode.left);
			}
		}

		root.right = right;
		return root;
	}