public int getDimensionIndex ( int dimension , int value ) { double min = valueMin [ dimension ] ; double max = valueMax [ dimension ] ; double fraction = ( ( value - min ) / ( max - min + 1.0 ) ) ; return ( int ) ( fraction * length [ dimension ] ) ; }
Given a value it returns the corresponding bin index in this histogram for integer values . The discretion is taken in account and 1 is added to the range .