оптимизируй код  public class FFT_Koef3 {
    private final int fs;
    private final int dataSize;
    private final int celoe, nn, nn1 ;
    private final double twoPI = PI*2, fh;
    private final double[] ffth, outData;
    private final int uu;
    private final int countStep;
    private int[] istep;
    private final double[] f_wpr, f_wpi, i_wpr, i_wpi;


    public FFT_Koef3(int fs, int dataSize) {
        this.fs = fs;
        this.dataSize = dataSize;
        this.celoe = (int) (floor(log(dataSize)/log(2)));
        this.nn = (int) round(pow(2,this.celoe));
        this.fh = (double) fs/nn;
        this.nn1 = (int) round(0.5 * nn);
        this.uu = 2 * nn;
        this.ffth = new double[nn1];
        this.outData = new double[uu];
        this.countStep = (int)floor(log(uu)/log(2)) - 1;
        this.istep = new int[countStep];
        this.f_wpi = new double[countStep];
        this.f_wpr = new double[countStep];
        this.i_wpi = new double[countStep];
        this.i_wpr = new double[countStep];
        int mmax = 2;
        for (int i = 0; i < countStep; i++) {
            istep[i] = 2 * mmax;
            double f_theta = twoPI / (-mmax );
            double i_theta = twoPI / (mmax);
            f_wpr[i] = -2 * pow(sin(0.5 * f_theta), 2);
            f_wpi[i] = sin(f_theta);
            i_wpr[i] = -2 * pow(sin(0.5 * i_theta), 2);
            i_wpi[i] = sin(i_theta);

            mmax = istep[i];
        }
        for (int i = 0; i < nn1; i++) {
            ffth[i] = i * fh;
        }

    }



    public double[] compute(double[] inData){
        return compute(inData, true);
    }

    public double[] compute(double[] inData, boolean forward){
        int  i, j, ii, m, mmax,  div1, div2, jj;
        double tempr, tempi, wtemp,  wr, wi;
        double[] wpr, wpi;

        if(dataSize == inData.length){
            for (i = 0; i < dataSize; i++) {
                j = 2 * i;
                outData[j] = inData[i];
                outData[j + 1] = 0;
            }

        }else{
            for (i = 0; i < inData.length; i++) {
                outData[i] = inData[i];
            }
        }
        if(forward) {
            wpr = f_wpr;
            wpi = f_wpi;
        }
        else{
            wpr = i_wpr;
            wpi = i_wpi;
        }

        j = 1;
        ii = 1;
        while(ii <= nn){
            i = 2 * ii - 1;
            if(j > i){
                tempr = outData[j-1];
                tempi = outData[j];
                outData[j-1] = outData[i-1];
                outData[j] = outData[i];
                outData[i-1] = tempr;
                outData[i] = tempi;
            }
            m = nn;
            while ((m >= 2)&&(j > m)){
                j -= m;
                m = m / 2;
            }
            j += m;
            ii++;
        }
        mmax = 2;

        for (int k = 0; k < countStep; k++){
            wr = 1;
            wi = 0;
            ii = 1;
            div1 = mmax / 2;

            while (ii <= div1){
                m = 2 * ii - 1;
                jj = 0;
                div2 = (uu - m) / istep[k];

                while (jj <= div2){
                    i = m + jj * istep[k];
                    j = i + mmax;
                    tempr = wr * outData[j-1] - wi * outData[j];
                    tempi = wr * outData[j] + wi * outData[j - 1];
                    outData[j - 1] = outData[i - 1] - tempr;
                    outData[j] = outData[i] - tempi;
                    outData[i - 1] = outData[i - 1] + tempr;
                    outData[i] = outData[i] + tempi;
                    jj++;
                }
                wtemp = wr;
                wr = wr * wpr[k] - wi * wpi[k] + wr;
                wi = wi * wpr[k] + wtemp * wpi[k] + wi;
                ii++;
            }
            mmax = istep[k];
        }
        if(forward){
            i = 1;
            while (i <= uu){
                outData[i - 1] = outData[i-1] / nn;
                i++;
            }
        }




        return outData;

    }
}