mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-12-02 15:03:22 +01:00
Added roundDown
Added another round function as required.
This commit is contained in:
parent
9196504c68
commit
80f658e748
@ -65,7 +65,7 @@ public class NumberUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rounds the number up to two digit points (Can be inaccurate due to using decimal-points)
|
* Rounds the number up to two decimal points (Can be inaccurate due to using decimal-points)
|
||||||
*
|
*
|
||||||
* @param number Number to round
|
* @param number Number to round
|
||||||
* @return Rounded number
|
* @return Rounded number
|
||||||
@ -73,6 +73,15 @@ public class NumberUtil {
|
|||||||
public static double roundUp(double number) {
|
public static double roundUp(double number) {
|
||||||
return Math.ceil(number * 100) / 100;
|
return Math.ceil(number * 100) / 100;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Rounds the number down to two decimal points
|
||||||
|
*
|
||||||
|
* @param number Number to round
|
||||||
|
* @return Rounded number
|
||||||
|
*/
|
||||||
|
public static double roundDown(double number) {
|
||||||
|
return Math.floor(number * 100) / 100;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts the number (in seconds) to timer-like format, like 2:00 (minutes:seconds)
|
* Converts the number (in seconds) to timer-like format, like 2:00 (minutes:seconds)
|
||||||
|
Loading…
Reference in New Issue
Block a user