code: public double getPower(double[] signal, int offset) {
          int M = hamming.length + offset;
          
          //hamming window
          for (int i = offset; i < M; i++) {
              signal[i] *= hamming[i-offset];
          }
          
          //Goertzel filter
          double d1 = 0.0;
          double d2 = 0.0;
          double y = 0;
          
          for (int n = offset; n < M; ++n) {
              y  = signal[n] + rw*d1 - d2;
              d2 = d1;
              d1 = y;
          }
          
          double resultr = 0.5*rw*d1 - d2;
          double resulti = iw*d1;
          
          return Math.sqrt( (resultr * resultr) + (resulti * resulti));
      }
docs: Calculates power of the specified frequence of the specified signal.
  
  @param signal sampled signal.
  @param offset index of the first sample of the signal.
  @return the power of the specified frequency