public void findMinAndMaxVals(){
  double[] data;
  double min=Double.MAX_VALUE;
  double max=-Double.MAX_VALUE;
  double z;
  for (int stack=0; stack < numberStacks; stack++) {
    for (int row=0; row < numberRows; row++) {
      data=getRowValues(row,stack);
      for (int col=0; col < numberColumns; col++) {
        z=data[col];
        if (z != noDataValue) {
          if (z < min) {
            min=z;
          }
          if (z > max) {
            max=z;
          }
        }
      }
    }
  }
  maximumValue=max;
  minimumValue=min;
}

public void findMinAndMaxVals ( ) { double [ ] data ; double min = Double . MAX_VALUE ; double max = - Double . MAX_VALUE ; double z ; for ( int stack = 0 ; stack < numberStacks ; stack ++ ) { for ( int row = 0 ; row < numberRows ; row ++ ) { data = getRowValues ( row , stack ) ; for ( int col = 0 ; col < numberColumns ; col ++ ) { z = data [ col ] ; if ( z != noDataValue ) { if ( z < min ) { min = z ; } if ( z > max ) { max = z ; } } } } } maximumValue = max ; minimumValue = min ; }
used to find the minimum and maximum values in the raster . nodatavalues are ignored . minimum and maximum values are stored in the minimumvalue and maximumvalue fields .
