Java Float Number Round round(float f, int dp)

Here you can find the source of round(float f, int dp)

Description

round

License

Open Source License

Declaration

public static float round(float f, int dp) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static float round(float f, int dp) {
        float pow = (float) Math.pow(10, dp);
        float round = Math.round(f * pow);
        return round / pow;
    }/*from   www .  j  a va  2  s .c  o m*/

    public static Float round(Float f, int dp) {
        return f != null ? round(f.floatValue(), dp) : null;
    }
}

Related

  1. round(final float x, final float roundFactor)
  2. round(float a)
  3. round(float amount, int cent)
  4. round(float axisValue)
  5. round(float d)
  6. round(float f, int i)
  7. round(float f, int n)
  8. round(float input)
  9. round(float input)