0

I have following code:

    Map<String, Double> finalAmountMap = new HashMap<String, Double>();
    Double test = 0d;
    finalAmountMap.put("chargeAmount",(-1*test));
    System.out.println(finalAmountMap);

Output : {1=-0.0}

If anything is multiplied with zero results in zero, but java Double multiplication of -1 with 0 is resulting in -0.0.

Details : Java version : 1.7.0_21 , Windows 32 bits

Due to this behavior northbound system rejecting values as -0.0 is not correct mathematical term.

Is it Java bug?

Rüdiger Herrmann
  • 20,512
  • 11
  • 62
  • 79
Alpesh Gediya
  • 3,706
  • 1
  • 25
  • 38

0 Answers0