public int maxMirror(int[] nums) {

        int[] numsCopy = new int[nums.length];

        for (int i = nums.length - 1, j = 0; i >= 0; i--, j++) {
            numsCopy[j] = nums[i];
        }

        int max = 0;

        for (int i = 0; i < nums.length; i++) {

            int count = 0;
            int pos1 = i;
            int pos2 = 0;
            boolean flag = false;

            while (pos1 < nums.length && pos2 < nums.length) {
                if (!flag) {
                    if (nums[pos1] != numsCopy[pos2]) {
                        pos2++;
                    } else
                    {
                        flag = true;
                        count = 1;
                        pos1++;
                        pos2++;
                    }
                } else
                {
                    if (nums[pos1] == numsCopy[pos2]) {
                        count++;
                        pos1++;
                        pos2++;
                    } else
                    {
                        if (count > max) {
                            max = count;
                        }
                        pos1 = i;
                        flag = false;
                    }
                }
                if (count > max) {
                    max = count;
                }
            }
        }

        return max;
    }