The list of methods to do Float Number Round are organized into topic(s).
int
round(float a) Rounds the number to the closest integer
return Math.round(a);
float
round(float amount, int cent) round
if (cent <= 0) {
throw new IllegalArgumentException("cent must be greater than 0");
int roundAmount = Math.round(amount * 100.0f);
int x = roundAmount % cent;
int discount = 0;
if (x > cent / 2.0f) {
discount = cent - x;
...
int
round(float axisValue) round
if (Math.abs(axisValue) < 0.4f) {
return 0;
return (int) Math.signum((int) (100 * axisValue));
int
round(float d) Ends up being a bit faster than Math#round(float) .
return (int) (d + (d < 0.0f ? -0.5f : 0.5f));
float
round(float f, int dp) round
float pow = (float) Math.pow(10, dp);
float round = Math.round(f * pow);
return round / pow;