The code below is supposed to find the maximum value of array
{6,15,2,5,8,14,10,16,11,17,13,7,1,18,3,4,9,12}. How can the code be substantially
improved, if at all? public static intmaxOfArray(int[] a) { int length = a.length; if(length<1)
throw new NoSuchElementException("Not at least one integer in array"); while (length >
1) { int k = length; for(inti = 0; i< length/2; i++) { k--; if(a[i]>a[k]) { int j = a[i]; a[i] = a[k];
a[k] = j; } } length /=2; } return a[0]; }