public class Stats {
/**
* Returns the maximum of an int array.
* @param a
*/
public static int maximum(int[] a)
{
int max = Integer.MIN_VALUE;
for(int i = 0; i < a.length; i++) {
if ( a[i] > max ) {
max = a[i];
}
}
return max;
}
/**
* Returns the mean (average) of values in an integer array
* @param a - the array
* @return the mean value of the array members
*/
public static double mean(int[] a)
{
double sum = 0.0;
for(int i = 0; i < a.length; i++) {
sum += a[i];
}
return sum / a.length;
}
}