Check if a Binary Tree is Symmetric

                boolean isSymmetric(Node r1, Node r2){
                    if(r1 == null && r2 == null){
                        return true;
                    }else{
                        if(r1 != null && r2 != null && r1.data == r2.data){
                            return isSymmetric(r1.left, r2.right) && isSymmetric(r1.right, r2.left);
                        }
                    }
                    return false;
                }
                boolean check(Node r){
                    if(r == null)
                        return true;
                    else
                       return isSymmetric(r.left, r.right);
                }