public class ReckercheDichotomiqueRecursiveEnConsole {

  public static double f(double x) {
    return(x*x*x-10.0);
  }

  public static double zero(double xi,double xf,double epsilon) {
    double x = (xf+xi)/2.0;
    if ( (xf-xi) < epsilon )
      return(x);
    if ( f(x) >= 0.0 )
      return(zero(xi,x,epsilon));
      else
      return(zero(x,xf,epsilon));
  }

  public static void main(String [] args) {
    Console.setTitle("ReckercheDichotomiqueRecursive");
    double xi = 1.0;
    double xf = 3.0;
    double x = zero(xi,xf,0.00001);
    Console.out.println(x);
    Console.out.println(f(x));
  }
}