Converting BigDecimal to Integer

后端 未结 8 989
既然无缘
既然无缘 2020-12-04 14:43

I have Hibernate method which returns me a BigDecimal. I have another API method to which I need to pass that number but it accepts Integer as parameter. I cannot change ret

相关标签:
8条回答
  • 2020-12-04 15:37

    Following should do the trick:

    BigDecimal d = new BigDecimal(10);
    int i = d.intValue();
    
    0 讨论(0)
  • 2020-12-04 15:42

    Have you tried calling BigInteger#intValue() ?

    0 讨论(0)
提交回复
热议问题