Converting BigDecimal to Integer

后端 未结 8 1011
既然无缘
既然无缘 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();
    

提交回复
热议问题