src/exercises/o2_executors/Problem2_2.java
private static int iterate(double re, double im, double cRe, double cIm, int iterations)
  {
    for (int i = 0; i < iterations; i++)
    {
      double tmpRe = re * re - im * im + cRe;
      double tmpIm = 2.0 * re * im + cIm;
      re = tmpRe;
      im = tmpIm;

      if (sqrt(re * re + im * im) > THRESHOLD)
        return i;
    }

    return iterations;
  }
// If the iteration converge the max value of iterations is return
If the iteration converge the max value of iterations is return
If the iteration converge the max value of iterations is return
private static int iterate(double re, double im, double cRe, double cIm, int iterations)
  {
    for (int i = 0; i < iterations; i++)
    {
      double tmpRe = re * re - im * im + cRe;
      double tmpIm = 2.0 * re * im + cIm;
      re = tmpRe;
      im = tmpIm;
      if (sqrt(re * re + im * im) > THRESHOLD)
        return i;
    }
    return iterations;
  }
private static int iterate ( double re , double im , double cRe , double cIm , int iterations ) { for ( int i = 0 ; i < iterations ; i ++ ) { double tmpRe = re * re - im * im + cRe ; double tmpIm = 2.0 * re * im + cIm ; re = tmpRe ; im = tmpIm ; if ( sqrt ( re * re + im * im ) > THRESHOLD ) return i ; } return iterations ; }
If the iteration converge the max value of iterations is return
If the iteration converge the max value of iterations is return