java.lang.ArrayIndexOutOfBoundsException

Hi @Kaluz,

Without seeing your code no one can determine the error location…

I guess the index is calculated in some ways…

int[] array = new int[6];
int a=5;
int b=6;
int index=a-b; // -1

int v=array[index]; // throws java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 6

Have you tried to run your sketch in debug mode?

Cheers
— mnse

2 Likes