private void FFT_meth(int dir, double x[], double y[], int n)
	{
		int nn = 1 << n;
		int i2 = nn >> 1;
		for (int i = 0, j = 0; i < nn - 1; i += 1)
		{
			if (i < j)
			{
				double tx = x[i];
				double ty = y[i];
				x[i] = x[j];
				y[i] = y[j];
				x[j] = tx;
				y[j] = ty;
			}
			int k = i2;
			while (k <= j)
			{
				j -= k;
				k >>= 1;
			}
			j += k;
		}
		double c1 = -1.0, c2 = 0.0;
		int l2 = 1;
		for (int l = 0; l < n; l += 1)
		{
			int l1 = l2;
			l2 <<= 1;
			double u1 = 1.0, u2 = 0.0;
			for (int j = 0; j < l1; j += 1)
			{
				for (int i = j; i < nn; i += l2)
				{
					int i1 = i + l1;
					double t1 = u1 * x[i1] - u2 * y[i1];
					double t2 = u1 * y[i1] + u2 * x[i1];
					x[i1] = x[i] - t1;
					y[i1] = y[i] - t2;
					x[i] += t1;
					y[i] += t2;
				}
				double z = u1 * c1 - u2 * c2;
				u2 = u1 * c2 + u2 * c1;
				u1 = z;
			}
			c2 = Math.sqrt((1.0 - c1) / 2.0);
			if (dir == 1)
				c2 = -c2;
			c1 = Math.sqrt((1.0 + c1) / 2.0);
		}
		if (dir == 1)
		{
			for (int i = 0; i < nn; i += 1)
			{
				x[i] /= (double) nn;
				y[i] /= (double) nn;
			}
		}
	}