ComplexUtils { public static Complex[] convertToComplex(double[] real) { final Complex c[] = new Complex[real.length]; for (int i = 0; i < real.length; i++) { c[i] = new Complex(real[i], 0); } return c; } private  ComplexUtils(); static Complex polar2Complex(double r, double theta); static Complex[] convertToComplex(double[] real);  }
@Test public void testConvertToComplex() { final double[] real = new double[] { negInf, -123.45, 0, 1, 234.56, pi, inf }; final Complex[] complex = ComplexUtils.convertToComplex(real); for (int i = 0; i < real.length; i++) { Assert.assertEquals(real[i], complex[i].getReal(), 0d); } }