Changed back from Java 1.7 to 1.5 since the code does not require any
new features of Java 1.7.
Check for bad likelihoods (negative infinity) and exit the sum early.