Actually in my code, floatValue of BigDecimal was taken. for bigger numbers onwards 17548097, it starts losing its precision and starts giving a difference of value 1. So thats why now i decided to take the doubleValue of BigDecimal.

Looks like this is the correct choice to be followed:

I checked using this code, Double value do not precision up to Double.MAX_VALUE
but when i do see this value Double.MAX_VALUE, it comes up in exponential format.

need to change the exponential format number into number represented without exponential format .