public void recoverTree(TreeNode root) {
        if (root == null)
            return;
        
        ArrayList<Bundle> arr = inOrderTraversal(root);
        if (arr.size() < 2)
            return;
        
        Bundle first = null, second = null;
        for (int i = 0; i < arr.size() - 1; i++) {
            if (arr.get(i).val > arr.get(i + 1).val) {
                first = arr.get(i);
                break;
            }
        }
        for (int i = arr.size() - 1; i > 0; i--) {
            if (arr.get(i).val < arr.get(i - 1).val) {
                second = arr.get(i);
                break;
            }
        }
        
        if (first == null || second == null)
            return;
        int temp = first.node.val;
        first.node.val = second.node.val;
        second.node.val = temp;
    }