MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / getMinMax

Method getMinMax

ij/src/main/java/ij/util/Tools.java:72–94  ·  view source on GitHub ↗

Determines the minimum and maximum value in the array a and returns them as 2-element array {minimum, maximum}.

(double[] a)

Source from the content-addressed store, hash-verified

70 /** Determines the minimum and maximum value in the array <code>a</code>
71 * and returns them as 2-element array {minimum, maximum}. */
72 public static double[] getMinMax(double[] a) {
73 double min = Double.NaN;
74 double max = Double.NaN;
75 int i=0;
76 for (; i<a.length; i++)
77 if (!Double.isNaN(a[i]))
78 break;
79 if (i<a.length) {
80 min = a[i];
81 max = a[i];
82 }
83 for (; i<a.length; i++) {
84 double value = a[i];
85 if (value<min)
86 min = value;
87 else if (value>max)
88 max = value;
89 }
90 double[] minAndMax = new double[2];
91 minAndMax[0] = min;
92 minAndMax[1] = max;
93 return minAndMax;
94 }
95
96 /** Determines the minimum and maximum value in the array <code>a</code>
97 * and returns them as 2-element array {minimum, maximum}. */

Callers 11

getPlotMethod · 0.95
multiPlotMethod · 0.95
doCurveFittingMethod · 0.95
showPlotMethod · 0.95
plotMethod · 0.95
setCalibrationMethod · 0.95
getPlotMethod · 0.95
getPlotMethod · 0.95
createRoiMethod · 0.95
addFitCurveMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected