Android Utililty Methods Float Round

List of utility methods to do Float Round


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


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)
BigDecimal bd = new BigDecimal(Float.toString(d));
bd = bd.setScale(decimalPlace, BigDecimal.ROUND_FLOOR);
return bd.floatValue();