Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { /** * conmputes hann window for given size * * @param n the length of the window * @return a Hann window as double[] */ public static double[] getHannWindow(int n) { double[] hann = new double[n]; for (int i = 0; i < n; i++) { hann[i] = 0.5 * (1 - Math.cos((2.0 * Math.PI * i) / (n - 1))); } return hann; } }