Here you can find the source of normalizeDecimalValue(BigDecimal bigDecimal, int allowedPrecision)
Parameter | Description |
---|---|
bigDecimal | a parameter |
allowedPrecision | precision configured by the user |
public static BigDecimal normalizeDecimalValue(BigDecimal bigDecimal, int allowedPrecision)
//package com.java2s; //License from project: Apache License import java.math.BigDecimal; public class Main { /**//from w w w . j a v a 2s . co m * This method will check the digits before dot with the max precision allowed * * @param bigDecimal * @param allowedPrecision precision configured by the user * @return */ public static BigDecimal normalizeDecimalValue(BigDecimal bigDecimal, int allowedPrecision) { if (bigDecimal.precision() > allowedPrecision) { return null; } return bigDecimal; } }