public static double[] computeAmplitudeSpectrum_FD(final double[] fft){
  if (fft == null)   throw new NullPointerException("Received null argument");
  int halfN=fft.length / 2;
  double[] freqs=new double[halfN];
  freqs[0]=fft[0];
  for (int i=2; i < fft.length; i+=2) {
    freqs[i / 2]=Math.sqrt(fft[i] * fft[i] + fft[i + 1] * fft[i + 1]);
  }
  return freqs;
}

public static double [ ] computeAmplitudeSpectrum_FD ( final double [ ] fft ) { if ( fft == null ) throw new NullPointerException ( "Received null argument" ) ; int halfN = fft . length / 2 ; double [ ] freqs = new double [ halfN ] ; freqs [ 0 ] = fft [ 0 ] ; for ( int i = 2 ; i < fft . length ; i += 2 ) { freqs [ i / 2 ] = Math . sqrt ( fft [ i ] * fft [ i ] + fft [ i + 1 ] * fft [ i + 1 ] ) ; } return freqs ; }
from the result of the fft ( in the frequency domain ) , compute the absolute value for each positive frequency , i . e . the norm of each complex number in the lower half of the array
