public Histogram toHistogram ( int size ) { Preconditions . checkArgument ( size > 1 , "histogram size must be greater than 1" ) ; float [ ] breaks = new float [ size + 1 ] ; float delta = ( max - min ) / ( size - 1 ) ; breaks [ 0 ] = min - delta ; for ( int i = 1 ; i < breaks . length - 1 ; ++ i ) { breaks [ i ] = breaks [ i - 1 ] + delta ; } breaks [ breaks . length - 1 ] = max ; return toHistogram ( breaks ) ; }
Computes a visual representation of the approximate histogram with a given number of equal - sized bins