private double getMin(ImageServiceBean bean) {
   if (bean.getMinimumCutBound() == null || bean.getMinimumCutBound().getBound() == null) {
     return bean.getMin().doubleValue();
   }
   return Math.max(
       bean.getMin().doubleValue(), bean.getMinimumCutBound().getBound().doubleValue());
 }
  private void createMaxMin(ImageServiceBean bean) {

    double[] stats = null;
    if (bean.getMin() == null) {
      if (stats == null) stats = getFastStatistics(bean); // do not get unless have to
      bean.setMin(stats[0]);
    }

    if (bean.getMax() == null) {
      if (stats == null) stats = getFastStatistics(bean); // do not get unless have to
      bean.setMax(stats[1]);
    }
  }