com.adtsw.jcommons.utils.NumberUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jdatalayer Show documentation
Show all versions of jdatalayer Show documentation
Connectors for common java projects
The newest version!
package com.adtsw.jcommons.utils;
import java.math.BigDecimal;
import java.math.RoundingMode;
public class NumberUtil {
public static double round(double input, int scale, RoundingMode mode) {
return new BigDecimal(input).setScale(scale, mode).doubleValue();
}
public static int getNumDecimals(Double value) {
String[] splitter = value.toString().split("\\.");
return splitter[1].length();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy