class Complex implements Serializable {

    public static Complex cart(final double re, final double im) {
        // most used complexes
        if (re == 0.0) {
            if (im == 1.0)
                return Complex.I;
            if (im == 0.0)
                return Complex.ZERO;
            if (im == -1.0)
                return Complex.NEG_I;
        } else if (im == 0.0) {
            if (re == 1.0) 
                return Complex.ONE;
            if (re == -1.0) 
                return Complex.NEG_ONE;
            if (re == -2.0) 
                return Complex.NEG_TWO;
        }
        // the real work
	return new Complex(re, im);
    }

    private  Complex(final double re, final double im);

}