Example usage for java.math BigDecimal BigDecimal

List of usage examples for java.math BigDecimal BigDecimal

Introduction

In this page you can find the example usage for java.math BigDecimal BigDecimal.

Prototype

public BigDecimal(long val) 

Source Link

Document

Translates a long into a BigDecimal .

Usage

From source file:Main.java

public static float lbTog(float paramFloat) {
    return new BigDecimal((float) (453.59237D * paramFloat)).setScale(2, 4).floatValue();
}

From source file:Main.java

public static int truncateDoubleToInt(double d) {
    return new BigDecimal(d).setScale(0, BigDecimal.ROUND_DOWN).intValue();
}

From source file:Main.java

public static int getRounding(float f) {
    BigDecimal a = new BigDecimal(f).setScale(0, BigDecimal.ROUND_HALF_UP);
    return a.intValue();
}

From source file:Main.java

public static float kgToLB_F(float paramFloat) {
    return new BigDecimal(2.0F * ((1.0F + 11023.0F * (10.0F * (paramFloat * 10.0F)) / 50000.0F) / 2.0F) / 10.0F)
            .setScale(1, 4).floatValue();
}

From source file:Main.java

public static float keep1Point2(float paramFloat) {
    return new BigDecimal(paramFloat).setScale(2, 4).floatValue();
}

From source file:Main.java

public static int getIntHalfUp(float f) {
    BigDecimal bd = new BigDecimal(f).setScale(BigDecimal.ROUND_HALF_UP);
    return bd.intValue();
}

From source file:Main.java

public static float kgToLB_target(float paramFloat) {
    return new BigDecimal(2.2046225F * paramFloat).setScale(5, 4).floatValue();
}

From source file:Main.java

public static String f2Bi(float d) {
    BigDecimal bigDecimal = new BigDecimal(d);
    bigDecimal = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP);
    return bigDecimal.toString();
}

From source file:Main.java

public static float getFloatByHalfUp(float f) {
    BigDecimal bd = new BigDecimal(f).setScale(2, BigDecimal.ROUND_HALF_UP);
    return bd.floatValue();
}

From source file:Main.java

public static float floatTo(float d) {
    BigDecimal bigDecimal = new BigDecimal(d);
    bigDecimal = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP);
    return bigDecimal.floatValue();
}