Java tutorial
//package com.java2s; public class Main { public static double[] complexMagnitude(double[] complexInput) { double[] magnitude = new double[complexInput.length / 2]; for (int i = 0; i < complexInput.length / 2; i++) { double re = complexInput[2 * i]; double im = complexInput[2 * i + 1]; magnitude[i] = Math.log(re * re + im * im + 0.001); } return magnitude; } }