Check out example codes for "get last index of array java". It will help you in understanding the concepts better.

Code Example 1

int[] someArray = {1,2,3,4,5};
int first = someArray[0];
int last = someArray[someArray.length - 1];
System.out.println("First: " + first + "\n" + "Last: " + last);

Learn ReactJs, React Native from akashmittal.com