public static float round ( float f , int decimalPlace ) { return BigDecimal . valueOf ( ( double ) f ) . setScale ( decimalPlace , BigDecimal . ROUND_HALF_UP ) . floatValue ( ) ; }
Round to certain number of decimals