code: public static double[] graphNiceRange(double max, double min, int nTick){
          if(max == min || !Double.isFinite(max)){
              if(max == 0.0 || !Double.isFinite(max)){
                  return new double[]{0.0, 1.0};
              }
  
              return graphNiceRange(1.5 * max, 0.5 * max, nTick);
          }
  
          double range = niceNum(max-min, false);
          double d = niceNum(range / (nTick-1), true );
          double graphMin = Math.floor(min/d)*d;
          double graphMax = Math.ceil(max/d)*d;
  
  
          return new double[]{graphMin, graphMax};
      }
docs: Convert the "messy" min/max values on a dataset to something clean. For example, 0.895732 becomes 1.0
  
  @param max   Maximum data point value
  @param min   Minimum data point value
  @param nTick Number of tick marks desired on chart (good setting: 5)
  @return double[] of length 2 - with new minimum and maximum