This is my method:
public static void B()
{
int vet[]=new int [100];
int vet2[]=new int [vet.length/2];
for(int i=0;i<=vet.length;i++)
{
vet[i]=i+1;
}
for(int i=0;i<vet.length;i++)
{
int rest = vet[i]%2;
if(rest==0)
{
vet2[i]=vet[i];
}
}
for (int i = 0; i <= vet2.length; i++)
{
if(vet2[i]==(vet2[i-1])-i)
{
System.out.println(vet2[i]+"É PALINDROMO");
}
}
And this is the error that appears:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 100 at lista1.pkg05.Lista105.B(Lista105.java:59) at lista1.pkg05.Lista105.main(Lista105.java:15) C:\Users\Pichau\AppData\Local\NetBeans\Cache.2\executor-snippets\run.xml:53:
Java returned: 1