3
我想从我已经在LinkedHashMap中填充的数据集计算百分位数。如何计算Java中的百分比?
Key Value
1 1
2 1
3 1
4 6
5 10
5 19
7 19
8 20
我怎样才能得到每个值的百分位数? 我正在使用下面的代码,这是不正确的百分点,我认为。
float i = test.size();
float k = test.size();
if (test.size() > 1) {
float n = (i-1)*100/i;
for (int j = 0; j <=i ;) {
if (i == 1) {
System.exit(0);
}
float a = (i-1)*100/k;
System.out.println("Percentile of lastvalue "+a);
i--;
System.out.println("Size of i "+i);
}
} else {
System.out.println("Bye");
}
如果有人能帮助我,请帮助
我期待输出这样的事情
Percentile of lastvalue 83.333336
Percentile of lastvalue 66.666664
Percentile of lastvalue 50.0
Percentile of lastvalue 33.333332
Percentile of lastvalue 16.666666
Percentiile西港岛线开始从最高vlaue countiion列表
是否存在的'value'要用于计算百分外部范围是多少?或者,1-20是范围? –
价值我disply这里是即将datnamic它可能是让或更 –
wnat获得每个值的百分位数 –