public double[] computeFFTReal(double[] dataReal) {

        if (dataReal == null) {
            return null;
        }

        /* compute the next power of two */
        double dnn = Math.log((double) dataReal.length) / Math.log(2.0);
        int log2nn = (int) Math.ceil(dnn);
        int fftLength = (int) Math.pow(2.0, (double) log2nn);
        // System.out.println("FFTLength: " + fftLength);

        /*
         * zeropad to next power of 2 and construct a 'complex' data array where even elements are
         * the real portion and the adjacent (+1) odd elements are the corresponding imaginary
         * portion (i.e. 0).
         */
        double[] dataCmplx = new double[2 * fftLength];
        for (int k = 0; k < fftLength; k++) {
            if (k < dataReal.length) {
                dataCmplx[2 * k] = dataReal[k];
                dataCmplx[2 * k + 1] = 0.0;
            } else {
                dataCmplx[2 * k] = 0.0;
                dataCmplx[2 * k + 1] = 0.0;
            }
        }

        double[] output = new double[fftLength * 2];
        createWeightFft(fftLength, this.inverse);
        recurseFft(dataCmplx, output, fftLength, this.inverse);

        if ((log2nn % 2) == 1) {
            return output;
        } else {
            return dataCmplx;
        }
    }