I have a simple task of dividing 1 by 10 power n where n value is dynamic. I need to save the result in a double variable. Until the divisor's value is 1000000 the double variable shows it properly which is 0.000001. Once the divisor value is more than 6 zeroes the value saved in double is in exponential form (scientific format ex: 1E-8). How do I resolve this problem as the double variable gets sent back as 0 when converted to json.
Things I cannot do: 1) Cannot use string as the variable is defined as double in an external Jar I use. I cannot change the type of the field. Most formatters use String. 2) I have no control on how many digits the divisor would be. It may be more than 15 digits too in some cases. 3) All the code that handles the conversion from object is done by jackson so I do not have control over there.