Goldbones Goldbones - 10 months ago 45
Java Question

Convert string with more than 20 digits to a number using Java

I have this string:


How can I transform this string to number, and maybe more digits? I tried Double.parseDouble and not work


You are right.

I´m making a call from Javascript and my call is:

url : "/myapp/data/selectedCampaign/thermal/"+data


When I entered this method in Spring

@RequestMapping(value = "/selectedCampaign/{type}/{evidenceValue}", method = RequestMethod.GET)
public @ResponseBody List<Double> getValues(@PathVariable("type") String type,
@PathVariable("evidenceValue") String evidenceValue)

evidenceValue is 0 and I was parsing 0

I still don t know why.

I reolve this issue by going to:

Spring MVC @PathVariable with dot (.) is getting truncated

Answer Source

use new BigDecimal("0.023526112354180534");