private int checkAndGetTotalCount ( ) throws IllegalStateException { int usedBuckets = 0 ; int totalCount = buckets [ 0 ] . getCount ( ) ; for ( int i = 1 ; i <= bucketNb ; i ++ ) { int bucketCount = buckets [ i ] . getCount ( ) ; totalCount += bucketCount ; if ( bucketCount > 0 ) { usedBuckets ++ ; } } totalCount += buckets [ bucketNb + 1 ] . getCount ( ) ; if ( usedBuckets < 3 ) { throw new IllegalStateException ( "Only " + usedBuckets + " buckets used, not enough for interpolation, consider reconfiguring min/max/nb" ) ; } return totalCount ; }
Computes expected count and check used buckets number .