private double getMaxValue(Angle angle,
                               double time, double timeStep, double epsilon, double delta,
                               FirstOrderIntegrator integrator, double[] initialState) {
        double max = 0;
        double timeOfMax = 0;
        double t = timeStep;
        while (t <= time){
            if (stop) {
                return 0;
            }
            t+=10*timeStep;
            double[] finalState;
            finalState = new double[] { 0, 0, 0, 0, 0, 0, 0 };
            FirstOrderDifferentialEquations ode = new LibrationODE(1000, epsilon, delta, 0.001078011072);
            integrator.integrate(ode, 0.0, initialState, t, finalState);
            double angleToPlot = AngleFactory.create(finalState, angle);
            if (angleToPlot >= max) {
                max = angleToPlot;
                timeOfMax = t;
            }
        }
        t = max(timeOfMax - 20, 0.0);
        while (t <= min(time, timeOfMax + 20)){
            if (stop) {
                return 0;
            }
            t+=timeStep;
            double[] finalState;
            finalState = new double[] { 0, 0, 0, 0, 0, 0, 0 };
            FirstOrderDifferentialEquations ode = new LibrationODE(1000, epsilon, delta, 0.001078011072);
            integrator.integrate(ode, 0.0, initialState, t, finalState);
            double angleToPlot = AngleFactory.create(finalState, angle);
            if (angleToPlot >= max) {
                max = angleToPlot;
                timeOfMax = t;
            }
        }
        return max;
    }