How to round off double to have max n number of digits including digits before and after decimal point.
Format : Numeric (10,8) [a maximum of 10 numeric digits, with up to 8 digits after the decimal place.
Example:
2233.64344206d should round to 2233.643442d.
2233.64344206d has 4 digits before decimal point, 8 after, total 12 digits, and there should be a maximum of 10 total digits. So 2233.643442d is the correct rounding result, because it has 4 digits before decimal point, 6 after, for a total of 10 digits.
java.text.DecimalFormat works to round of number after decimal point. eg if i want to round off number to have max 4 digits after decimal point then i can use DecimalFormat("#0.####")