question: public static boolean assertDistribution ( final double [ ] da ) { double sum = 0.0 ; for ( final double d : da ) { Exam . assertTrue ( Utils . realFormat ( d ) , d >= 0.0 && d <= ( 1.0 + TOLERANCE ) && ! Double . isNaN ( d ) ) ; sum += d ; } if ( Exam . checkEquals ( 1.0 , sum , 0.0001 ) ) { return true ; } throw new Exam . ExamException ( "sum=" + Utils . realFormat ( sum ) + "  " + Utils . realFormatArray ( da ) ) ; }
target:  Assert that the array contains a valid probability distribution that sums to 1.0.