How do I determine number of integer digits and the number of digits after decimal in a number like 234.12413
in Java.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
1) convert to string
2) substring from '.' to end
3) get the length of this substring
A double is not always an exact representation. You can only say how many decimal places you would have if you converted it to a String.
This will only work for numbers which are not turned into exponent notation. You might consider 1.0 to have one or no decimal places.