A probabilistic method for calculating the energy of hydrophobic interactions