Android Float Round round(float d, int decimalPlace)

Here you can find the source of round(float d, int decimalPlace)

Description

round

Declaration

public static float round(float d, int decimalPlace) 

Method Source Code

//package com.java2s;
import java.math.BigDecimal;

public class Main {
    public static float round(float d, int decimalPlace) {
        BigDecimal bd = new BigDecimal(Float.toString(d));
        bd = bd.setScale(decimalPlace, BigDecimal.ROUND_FLOOR);
        return bd.floatValue();
    }/*  www.  j  av  a  2 s.c  o  m*/
}

Related

  1. getIntWithRound(float f)
  2. getFloatWithADecimal(float f)
  3. FloatToInt(float f)