class MathUtil {

    public static double normalize(double value, double min, double max)
    {
        double range = max - min;
        double normalized = (value - min) % range + min;
        if (normalized < min)
        {
            normalized += range;
        }
        return normalized;
    }

    private  MathUtil();

}