Java tutorial
//package com.java2s; public class Main { private static void multTwiddleFactor(int index, float[] real, float[] img, int pos, int sum) { float cosArg = (float) Math.cos(-2.0f * Math.PI * pos / (float) sum); float sinArg = (float) Math.sin(-2.0f * Math.PI * pos / (float) sum); float r = real[index] * cosArg - img[index] * sinArg; float i = real[index] * sinArg + img[index] * cosArg; real[index] = r; img[index] = i; } }