public class ArrayOperations { public static int getTotal(int[] arr) { int total = 0; for (int value: arr) total += value; return total; } public static double getTotal(double[] arr) { double total = 0; for (double value: arr) total += value; return total; } public static float getTotal(float[] arr) { float total = 0; for (float value: arr) total += value; return total; } public static long getTotal(long[] arr) { long total = 0; for (long value: arr) total += value; return total; } public static double getAverage(int[] arr) { return getTotal(arr) / (double)arr.length; } public static double getAverage(double[] arr) { return getTotal(arr) / (double)arr.length; } public static double getAverage(float[] arr) { return getTotal(arr) / (double)arr.length; } public static double getAverage(long[] arr) { return getTotal(arr) / (double)arr.length; } public static int getHighest(int[] arr) { int highest = arr[0]; for (int value: arr) { if (value > highest) highest = value; } return highest; } public static double getHighest(double[] arr) { double highest = arr[0]; for (double value: arr) { if (value > highest) highest = value; } return highest; } public static float getHighest(float[] arr) { float highest = arr[0]; for (float value: arr) { if (value > highest) highest = value; } return highest; } public static long getHighest(long[] arr) { long highest = arr[0]; for (long value: arr) { if (value > highest) highest = value; } return highest; } public static int getLowest(int[] arr) { int lowest = arr[0]; for (int value: arr) { if (value < lowest) lowest = value; } return lowest; } public static double getLowest(double[] arr) { double lowest = arr[0]; for (double value: arr) { if (value < lowest) lowest = value; } return lowest; } public static float getLowest(float[] arr) { float lowest = arr[0]; for (float value: arr) { if (value < lowest) lowest = value; } return lowest; } public static long getLowest(long[] arr) { long lowest = arr[0]; for (long value: arr) { if (value < lowest) lowest = value; } return lowest; } }