public static int findGlobalPeakLocation(float[] data){
  float max=Float.NaN;
  int imax=-1;
  for (int i=0; i < data.length; i++) {
    if (Float.isNaN(data[i]))     continue;
    if (Float.isNaN(max) || data[i] > max) {
      max=data[i];
      imax=i;
    }
  }
  return imax;
}

public static int findGlobalPeakLocation ( float [ ] data ) { float max = Float . NaN ; int imax = - 1 ; for ( int i = 0 ; i < data . length ; i ++ ) { if ( Float . isNaN ( data [ i ] ) ) continue ; if ( Float . isNaN ( max ) || data [ i ] > max ) { max = data [ i ] ; imax = i ; } } return imax ; }
find the maximum of all elements in the array , ignoring elements that are nan .
