Fasting can be a very beneficial experience. Have some care and common sense though. By fasting, we purify the state of our mind. All religions have a type of fasting or temperance, and it is good to do it in some form from time to time.
You can do it for as many days as you wish. 40 is mem, which is related with water, and therefore sexuality.