Android Utililty Methods Float Round

List of utility methods to do Float Round

Description

The list of methods to do Float Round are organized into topic(s).

Method

intgetIntWithRound(float f)
get Int With Round
return Math.round(f);
floatgetFloatWithADecimal(float f)
get Float With A Decimal
f = Math.round(f * 10);
return f / 10;
intFloatToInt(float f)
Float To Int
return Float.floatToIntBits(f);
floatround(float d, int decimalPlace)
round
BigDecimal bd = new BigDecimal(Float.toString(d));
bd = bd.setScale(decimalPlace, BigDecimal.ROUND_FLOOR);
return bd.floatValue();