Next Palindrome

is there anyone can help me? I thinks my code is right but it still give the wrong output, especially the first index

import java.util.Scanner;
public class Main {

public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    System.out.println("Welcome to Next Palindrome program!!!");
    System.out.print("Please enter a number and i will give you the smallest next palindrome :");
    int i = 0;
    while (i==0){
        int input = sc.nextInt();
        if (input < 0 ){
            System.out.println("Invalid input!! Please enter a positive number : ");
        } else{
            int t = 0;
            int intCheck = input+1;
            while (t == 0){
                //get input length
                int inputlength = 0;
                int k = 0;
                int l = 1;
                while(k == 0){
                    if(intCheck< Math.pow(10,l)){
                        inputlength = l;
                        k = 1;
                    }else{
                        l++;
                    }
                }

                //mengubah integer menjadi arrray
                int[] a = new int[inputlength];
                for(int j = 0; j<inputlength;j++){
                    a[j] = (intCheck% (int)(Math.pow(10, (j+1))))/(int)(Math.pow(10,j));
                }

                //menentukan jumlah digit input genap atau ganjil
                int mid = a.length/2;
                int remainder = a.length%2;
                boolean isOdd = false;
                if (remainder == 1){
                    isOdd= true;
                }

                //cek palindrome
                boolean isPalindrome = false;
                int y = mid-1;
                int u;
                if (isOdd){
                    u = mid + 1;
                }else{
                    u = mid;
                }
                while(y>= 0){
                    if (a[y] == a[u]){
                        isPalindrome = true;
                    }else{
                        break;
                    }
                    y--;
                    u++;
                }

                if(isPalindrome){
                    for (int j : a) {
                        System.out.print(j);
                    }
                    t = 1;
                } else{
                    intCheck++;
                }
                i = 1;
            }
        }
    }

}

}