private void discretize ( double [ ] d , int n ) { if ( coarseness == 0.0 ) return ; for ( int i = 0 ; i < n ; i ++ ) { d [ i ] = ( Math . rint ( resolution * d [ i ] ) / resolution ) ; } }
Discretize elements of array to a lower resolution . For example if resolution = 100 . the value 3 . 14159265358979 will be changed to 3 . 14 .