public class Debug { public static int getLastElement(int arr[]) { // returns the last element of arr[] int s = arr.length; return arr[s - 1]; } public static void main(String a[]) { int r[] = new int[6]; r[0] = 0; r[1] = 3; r[2] = 17; r[3] = 200; r[4] = 1560; r[5] = 2017; System.out.println(getLastElement(r)); } }