package helloworld;

/**
 * A series of useful array functions.
 * @author Kevin Ji <kevin.ji@outlook.com>
 */
public class ArrayFuncs {
    public static double max(double[] array) {
        double max = array[0];
        
        for (int i = 1; i < array.length; i++) {
            if (array[i] > max) {
                max = array[i];
            }
        }
        
        return max;
    }
    
    public static double min(double[] array) {
        double min = array[0];
        
        for (int i = 1; i < array.length; i++) {
            if (array[i] > min) {
                min = array[i];
            }
        }
        
        return min;
    }
    
    public static double sum(double[] array) {
        double sum = 0;
        
        for (double element : array) {
            sum += element;
        }
        
        return sum;
    }
    
    public static double[] concatenate(double[] array1, double[] array2) {
        double[] newArray = new double[array1.length + array2.length];
        
        for (int i = 0; i < array1.length; i++) {
            newArray[i] = array1[i];
        }
        
        for (int i = 0; i < array2.length; i++) {
            // Shift to account for the elements already in newArray
            newArray[array1.length + i] = array2[i];
        }
        
        return newArray;
    }
    
    public static void main(String[] args) {
        double[] array = {2.3, -1.4, 5.9, 6.2, 0, -3.5};
        System.out.println("Maximum: " + max(array)); // 6.2
        System.out.println("Minimum: " + min(array)); // -3.5
    }
}

@@ -16,16 +16,44 @@
 rld;%0D%0A%0D%0A
+import java.util.Arrays;%0D%0A%0D%0A
 /**%0D%0A * 
@@ -1423,32 +1423,660 @@
 ;%0D%0A    %7D%0D%0A    %0D%0A
+    public static double%5B%5D reverse(double%5B%5D array) %7B%0D%0A        int length = array.length;%0D%0A        double%5B%5D newArray = new double%5Blength%5D;%0D%0A        %0D%0A        for (int i = 0; i %3C length; i++) %7B%0D%0A            newArray%5Blength - i - 1%5D = array%5Bi%5D;%0D%0A        %7D%0D%0A        %0D%0A        return newArray;%0D%0A    %7D%0D%0A    %0D%0A    public static void reverseInPlace(double%5B%5D array) %7B%0D%0A        int stopIndex = array.length / 2 - 1;%0D%0A        %0D%0A        for (int i = 0; i %3C= stopIndex; i++) %7B%0D%0A            double temp = array%5Bi%5D;%0D%0A            array%5Bi%5D = array%5Barray.length - i - 1%5D;%0D%0A            array%5Barray.length - i - 1%5D = temp;%0D%0A        %7D%0D%0A    %7D%0D%0A    %0D%0A
     public stati
@@ -2159,16 +2159,21 @@
  0, -3.5
+, 4.2
 %7D;%0D%0A    
@@ -2293,16 +2293,331 @@
 / -3.5%0D%0A
+        System.out.println(%22Sum: %22 + sum(array)); // 13.7%0D%0A        %0D%0A        System.out.println(%22Reversed: %22 + Arrays.toString(reverse(array)));%0D%0A        // %5B4.2, -3.5, 0.0, 6.2, 5.9, -1.4, 2.3%5D%0D%0A        %0D%0A        reverseInPlace(array);%0D%0A        System.out.println(%22Reversed in place: %22 + Arrays.toString(array));%0D%0A
     %7D%0D%0A%7D

Create reverse methods, add test code