|| SIMPLE, EASY AND QUICK JAVA SOLUTION ||
Bold# Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n-
**Bold**# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int reinitializePermutation(int n) {\n        int res = 0;\n        for (int i = 0; i < n; i++) {\n            int k = 1;\n            int p = i;\n            while (p!=1) {\n                if (p % 2 == 0) \n                {\n                    p = p / 2;\n                } \n                else \n                {\n                    p = n / 2 + (p - 1) / 2;\n                }\n                if (p == i) \n                {\n                    break;\n                }\n                k++;\n            }\n            if (res < k) \n            {\n                res = k;\n            }\n        }\n        return res;\n    }\n}\n\n```
['Java']