public static double [ ] range2Bins ( double min , double max , int binsNum ) { double delta = ( max - min ) / binsNum ; double [ ] bins = new double [ binsNum + 1 ] ; int count = 0 ; double running = min ; for ( int i = 0 ; i < binsNum ; i ++ ) { bins [ count ] = running ; running = running + delta ; count ++ ; } bins [ binsNum ] = max ; return bins ; }
Creates an array of equal bin from a range and the number of bins .