public TreeNode buildTree(int[] inorder, int[] postorder) {
        int length = inorder.length;
        if(length ==0)
            return null;
        int pos = indexOf(inorder,postorder[length-1]);
        TreeNode node = new TreeNode(postorder[length-1]);
        if(pos >0)
            node.left = buildTree(Arrays.copyOfRange(inorder,0,pos),
                    Arrays.copyOfRange(postorder,0,pos));
        else
            node.left = null;
        if(pos < length)
            node.right = buildTree(Arrays.copyOfRange(inorder,pos+1,length),
                    Arrays.copyOfRange(postorder,pos,length-1));
        else
            node.right = null;
        return node;
    }