public TreeNode getTree(int[] preorder, int pre_begin, int pre_end,
			int[] inorder, int in_begin, int in_end) {
		if (pre_begin > pre_end || in_begin > in_end)
			return null;
		// get root
		TreeNode root = new TreeNode(preorder[pre_begin]);
		int root_index = in_begin;
		while (root_index < in_end) {
			if (inorder[root_index] == root.val) {
				break;
			}
			root_index++;
		}

		root.left = getTree(preorder, pre_begin + 1, pre_begin + root_index
				- in_begin, inorder, in_begin, root_index - 1);
		root.right = getTree(preorder, pre_begin + root_index - in_begin + 1,
				pre_end, inorder, root_index + 1, in_end);
		return root;
	}