ComplexBuilder implements IBuilder<Complex> { public ComplexBuilder inv() { double scalar, zRe, zIm; if (Math.abs(re) >= Math.abs(im)) { scalar = 1.0 / (re + im * (im / re)); zRe = scalar; zIm = scalar * (-im / re); } else { scalar = 1.0 / (re * (re / im) + im); zRe = scalar * (re / im); zIm = -scalar; } re = zRe; im = zIm; return this; } ComplexBuilder(final Complex c);  ComplexBuilder(final double re);  ComplexBuilder(final double re, final double im); double getRe(); double getIm(); ComplexBuilder add(final Complex c); ComplexBuilder add(final double a); ComplexBuilder chs(); ComplexBuilder div(final Complex c); ComplexBuilder div(final double r); ComplexBuilder inv(); ComplexBuilder mul(final Complex c); ComplexBuilder mul(final double r); ComplexBuilder mul(final double x, final double y); ComplexBuilder sub(final Complex c); ComplexBuilder sub(final double r); @Override Complex build();  }
@Test public void testInv() { assertEquals(c1.inv(), new ComplexBuilder(c1).inv().build()); }