I need a Java code to find the length of a formatted decimal. Eg – 345.4 it should return 5
Since the value is formatted so it omits 0 from the value 345.40
It should be written using BigDecimal
I need a Java code to find the length of a formatted decimal. Eg
Share
Once you have you
BigDecimal, you can convert it to a plain string usingtoPlainString()method. Thus, thelength()method of theStringclass gives you the length of your BigDecimal.