Basic Java statistics class
First of all, I object to the get… naming convention.  "Get" implies that you are retrieving something that already exists (usually, though not always, paired with "set").  You wouldn't call Math.getCos(theta), would you?

The problems stem from accepting arrays in the first place.  The class would be much more useful as an accumulator, like this:

Statistics stats = new Statistics();
stats.datum(3);
stats.datum(4);
stats.datum(5);
System.out.println(stats.mean());
System.out.println(stats.stdDev());


A simple way to calculate the mean, variance, and standard deviation is to keep running totals \$\sum x_i^0\$ (i.e., the count), \$\sum x_i^1\$ (i.e., the sum), and \$\sum x_i^2\$ (i.e., the sum of the squares).  However, see Algorithms for calculating variance for a discussion of the merits of this method compared to others.

You could write

import java.util.OptionalDouble;

public class Statistics {
    private int sum0;
    private double sum1, sum2;

    public void datum(double x) {
        this.sum0++;
        this.sum1 += x;
        this.sum2 += x * x;
    }

    public int count() {
        return this.sum0;
    }

    public double sum() {
        return this.sum1;
    }

    public OptionalDouble mean() {
        if (this.count() == 0) {
            return OptionalDouble.empty();
        } else {
            return OptionalDouble.of(this.sum() / this.count());
        }
    }

    public OptionalDouble variance() {
        if (this.count() == 0) {
            return OptionalDouble.empty();
        } else {
            return OptionalDouble.of(
                   (this.sum2 - this.sum() * this.sum() / this.count())
                   / //////////////////////////////////////////////// /
                                     this.count()
            );
        }
    }

    public OptionalDouble stdDev() {
        if (this.count() == 0) {
            return OptionalDouble.empty();
        } else {
            return OptionalDouble.of(Math.sqrt(this.variance().getAsDouble()));
        }
    }
}


The median is trickier to calculate, as you would have to keep a list of all of the values.



Note that DoubleStream already gives you count(), sum(), and average().