Next palindrome

Can someone please help with this code i keep getting a runtime error

import java.io.*;
public class Main
{
public static void main(String args[])throws IOException
{
BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
int testcases=Integer.parseInt(br.readLine());
int nums[]=new int[testcases];
for(int i=0;i<testcases;i++)
{

      nums[i]=Integer.parseInt(br.readLine());
  }
  for(int i=0;i<testcases;i++)
  {
      System.out.println(palindrome(nums[i]+1));
  }           

}
public static int palindrome(int number)
{
int rev=0;
for(int i=number;i<1000000;i++)
{
rev=0;
int dig,temp;
temp=i;
while(temp!=0)
{
dig=temp%10;
temp=temp/10;
rev=rev*10+dig;
}
if(rev==i)
break;
}
return(rev);
}
}