You need to count from zero so your last field of an array with the length of 5 is 4
Example:
String examplearray[]=new String [5];
System.out.println(examplearray.length)
>>>5//this is the length
examplearray={"1","2","3","4","5"}//filling the array
System.out.println(examplearray.length)
>>>5//still the same length
System.out.println(examplearray[4])
>>>"5"//the content of the examplearray[4] field