All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.bytefish.pgbulkinsert.util.BigDecimalUtils Maven / Gradle / Ivy

There is a newer version: 7.0.1
Show newest version
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

package de.bytefish.pgbulkinsert.util;

import java.math.BigDecimal;
import java.math.MathContext;

public final class BigDecimalUtils {

    private BigDecimalUtils() {}

    public static BigDecimal toBigDecimal(Integer intValue) {
        return new BigDecimal(intValue.toString());
    }

    public static BigDecimal toBigDecimal(Integer intValue, MathContext mathContext) {
        return new BigDecimal(intValue.toString(), mathContext);
    }

    public static BigDecimal toBigDecimal(Long longValue) {
        return new BigDecimal(longValue.toString());
    }

    public static BigDecimal toBigDecimal(Long longValue, MathContext mathContext) {
        return new BigDecimal(longValue.toString(), mathContext);
    }

    public static BigDecimal toBigDecimal(Float floatValue) {
        return new BigDecimal(floatValue.toString());
    }

    public static BigDecimal toBigDecimal(Float floatValue, MathContext mathContext) {
        return new BigDecimal(floatValue.toString(), mathContext);
    }

    public static BigDecimal toBigDecimal(Double doubleValue) {
        return new BigDecimal(doubleValue.toString());
    }

    public static BigDecimal toBigDecimal(Double doubleValue, MathContext mathContext) {
        return new BigDecimal(doubleValue.toString(), mathContext);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy