code: public static void FFT(ComplexNumber[] data, Direction direction) {
          double[] real = ComplexNumber.getReal(data);
          double[] img = ComplexNumber.getImaginary(data);
          if (direction == Direction.Forward)
              FFT(real, img);
          else
              FFT(img, real);
          if (direction == Direction.Forward) {
              for (int i = 0; i < real.length; i++) {
                  data[i] = new ComplexNumber(real[i], img[i]);
              }
          } else {
              int n = real.length;
              for (int i = 0; i < n; i++) {
                  data[i] = new ComplexNumber(real[i] / n, img[i] / n);
              }
          }
      }
docs: 1-D Fast Fourier Transform.
  
  @param data      Data to transform.
  @param direction Transformation direction.