create Big Decimal - Java java.math

Java examples for java.math:BigDecimal

Description

create Big Decimal

Demo Code


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

public class Main {
    public static BigDecimal createBigDecimal(double v) {
        return new BigDecimal(v);
    }/*from w ww .  j ava 2 s  .c  o  m*/

    public static BigDecimal createBigDecimal(String strVal) {
        if (strVal == null || strVal.equals("")) {
            return new BigDecimal(0);
        }
        return new BigDecimal(strVal);
    }

    public static BigDecimal createBigDecimal(float f) {
        return new BigDecimal(f);
    }
}

Related Tutorials