Added roundDown

Added another round function as required.
This commit is contained in:
meiamsome 2012-08-18 21:56:46 +02:00
parent 9196504c68
commit 80f658e748
1 changed files with 10 additions and 1 deletions

View File

@ -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
* @return Rounded number
@ -73,6 +73,15 @@ public class NumberUtil {
public static double roundUp(double number) {
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)