code: private double calcSD(double[] arr, double mean) {
          double sd = 0;
          for (double resid : arr) {
              sd += Math.pow(resid - mean, 2);
          }
          sd = Math.sqrt(sd/arr.length);
          return sd;
      }
docs: Output: standard deviation of array