code: private double[] findMinMaxWithErrorBars(
        Collection<? extends Number> data, Collection<? extends Number> errorBars) {
  
      double min = Double.MAX_VALUE;
      double max = -Double.MAX_VALUE;
  
      Iterator<? extends Number> itr = data.iterator();
      Iterator<? extends Number> ebItr = errorBars.iterator();
      while (itr.hasNext()) {
        double bigDecimal = itr.next().doubleValue();
        double eb = ebItr.next().doubleValue();
        if (bigDecimal - eb < min) {
          min = bigDecimal - eb;
        }
        if (bigDecimal + eb > max) {
          max = bigDecimal + eb;
        }
      }
      return new double[] {min, max};
    }
docs: Finds the min and max of a dataset accounting for error bars
  
  @param data
  @param errorBars
  @return