protected void makeSinCosTables()
	{
                // First determine max k.
                int pmax = -Integer.MAX_VALUE;
                int localnu1 = nu1;
                int localn2 = n2;
                int k = 0;
                for (int l = 1; l <= nu; l++)
                {
                        while (k < n)
                        {
                                for (int i = 1; i <= localn2; i++)
                                {
                                        int p = bitrev (k >> localnu1);
                                        if (p > pmax)
                                                pmax = p;
                                        k++;
                                }
                                k += localn2;
                        }
                        k = 0;
                        localnu1--;
                        localn2 = localn2/2;
                }
                localnu1 = nu1;
                localn2 = n2;
                try
                {
                        C = new double[pmax+1];
                        S = new double[pmax+1];
                        // Now calculate actual table values.
                        k = 0;
                        for (int l = 1; l <= nu; l++)
                        {
                                while (k < n)
                                {
                                        for (int i = 1; i <= localn2; i++)
                                        {
                                                int p = bitrev (k >> localnu1);
                                                double arg = 2 * Math.PI * (double) p / n;
                                                C[p] = Math.cos (arg);
                                                S[p] = Math.sin (arg);
                                                k++;
                                        }
                                        k += localn2;
                                }
                                k = 0;
                                localnu1--;
                                localn2 = localn2/2;
                        }
                } catch (Exception e) { e.printStackTrace(); }
                System.out.println("FFT sin and cos tables length "+(pmax+1));
	}