mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-10 18:37:57 +01:00
Fixed rounding
This commit is contained in:
parent
1d0939d916
commit
a7e65bdcd9
@ -1,6 +1,7 @@
|
||||
package main.java.com.djrapitops.plan.utilities.analysis;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.OptionalDouble;
|
||||
import java.util.OptionalInt;
|
||||
@ -169,6 +170,8 @@ public class MathUtils {
|
||||
return biggest.isPresent() ? biggest.getAsLong() : 1;
|
||||
}
|
||||
|
||||
private static final DecimalFormat df = new DecimalFormat("#.##");
|
||||
|
||||
/**
|
||||
* Rounds the double to a double with two digits at the end.
|
||||
* Output: #.##
|
||||
@ -177,6 +180,6 @@ public class MathUtils {
|
||||
* @return The rounded number
|
||||
*/
|
||||
public static double round(double number) {
|
||||
return Math.round(number * 100.0) / 100.0;
|
||||
return Double.valueOf(df.format(number));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user