How to work with complex numbers in java?
<p>I am new to java and not sure how to deal with complex numbers in java. I am writing a code for my project. I have used Euler's identity, exp(i<em>theeta) = cos(theeta)+i</em>Sin(theeta) to find exp(i*2*pi*f). I have to multiply this resulting complex number with another number from an array "d". Here is what I have done</p>

<pre><code>Complex Data[][] = new Complex[20][20];
for (int j = 0; j &lt; d.size(); j++){
    for (int k = 0; k&lt;20; k++){
        for (int l = 0; l&lt;20; l++){
            double re = Math.cos(2 * Math.PI * f);
            double im = Math.sin(2 * Math.PI * f);
            Complex p = new Complex(re, im);
            Data[k][l] = ((d.get(j) * p.getReal()), (d.get(j) * p.getImaginary()));     
        }   
    }
}
</code></pre>

<p>I am, however, getting an error on the expression <code>Data[k][l] = ((d.get(j) * p.getReal()), (d.get(j) * p.getImaginary()));</code> saying "The left-hand side of an assignment must be a variable". 
Please help me resolve this issue. Thanks</p>