List of utility methods to do Number Round
double | roundSignificant(double value) Rounds a number, keeping at least 3 significant digits. if (value >= 10.0 || value <= -10.0) { return getRounded(value, 1); } else { return roundToSignificantDigits(value, 3); |
int | roundSimpleNumberUnits(final long graphDefaultUnit) round Simple Number Units float unit = graphDefaultUnit; int multiplier = 1; while (unit > 20) { multiplier *= 10; unit /= 10; unit = unit >= 10 ? 10 : ... |
int[] | roundSizes(float[] sizes) Round a number of float sizes into int sizes so that the total length match up int[] retInts = new int[sizes.length]; float posD = 0; for (int i = 0; i < retInts.length; i++) { int posI = (int) (posD + 0.5f); posD += sizes[i]; retInts[i] = (int) (posD + 0.5f) - posI; return retInts; ... |
double | roundSonekiSuii(double amount1, double amount2) round Soneki Suii return round(((amount1 / amount2) * 100), 1);
|
int | roundsToTicks(double x) D&D rounds to ticks (2 seconds per round) return secondsToTicks(x * SEC_PER_ROUND);
|
String | roundStr(Double value, int decimal) round Str return String.format("%1." + decimal + "f", value); |
String | roundString(double d) Rounds the number returning a string representation of the numner if (d == 0.0) return "" + d; int digits = (int) (Math.log(d) / Math.log(10)); int n = 3 - digits; return fixBug("" + round(d, n), n); |
String | roundString(double n, double range, double precision) round String double v = range * precision; int i = 0; while (v < 1) { v *= 10; i++; return roundString(n, i); |
long | roundTime24h(final long defaultUnitValue) round Timeh float unit = defaultUnitValue; int multiplier = 1; while (unit > 3600) { multiplier *= 3600; unit /= 3600; float unitRounded = unit; if (multiplier >= 3600) { ... |
long | roundTimeStamp(long tstamp) round Time Stamp return (tstamp / 1000) * 1000;
|