1

I'm having trouble in displaying values in JSP, if entry with 4 decimal places has 3 zeroes before the last digit, it is displayed as 3.0E-4. Ex: 0.0004 entry displays 4.0E-4; 0.0001 displays 1.0E-4

Other entries with 4 decimal places has 1 or 2 zeroes before the last digit displays correctly. Ex: 0.0040 entry displays 0.0040 ,whole number entries displays correctly. Ex 1.0003 display 1.0003. It should display the actual values.

I used decimal formatter

DecimalFormat d4 = new DecimalFormat(",##0.0000");
Karol Dowbecki
  • 43,645
  • 9
  • 78
  • 111
oma
  • 21
  • 1
  • 4
  • 1
    Possible duplicate of [How do I print a double value without scientific notation using Java?](https://stackoverflow.com/questions/16098046/how-do-i-print-a-double-value-without-scientific-notation-using-java) – k_ssb Apr 26 '18 at 00:52
  • Check the other answers to see multiple solution to the problem, one using `DecimalFormat`. – AxelH Apr 26 '18 at 09:49
  • PS: provide a [mcve] of the usage you have in the JSP. Easier to validate the problem. – AxelH Apr 26 '18 at 09:51
  • I have solved the problem by declaring the value from double to Big Decimal format.. Thank you guys.. – oma Apr 27 '18 at 09:04

0 Answers0