I want to validate that a float or Double has minimum 5 numbers after decimal points.This is the code I have written
private boolean invalidDecimalPrecision(Double point)
{
int decimalPrecision = BigDecimal.valueOf(point).scale();
return !(decimalPrecision >= 5);
}
Is it good enough or do I have to handle specific case of negative scale numbers as well
The plugin which generates Pojos has accepted the feature request for adding an option to represent Double as BigDecimal