I do
Collections.frequency(List<String>, List<String>.get(i)) / List<String>.size()
The output for the above calculation should be (for example)
0.00631
0.0002378
0.00571
but I get 0.0, instead.
How do I handle this? I keep getting 0.0 with double and float
Thanks
If the values
0.00631,0.0002378and0.00571are expected results from divisions, make sure you’re not doing integer divisions. That is, make sure to cast numerator or denominator to float or double.Instead of
you can do
In your particular case, you could try something like