cancel
Showing results for 
Search instead for 
Did you mean: 

Very easy question - BigDecimal to Integer conversion

Former Member
0 Kudos

Hi Experts,

Following statement is not working. wdContext.nodeI_Catsdbcomm().getI_CatsdbcommElementAt(iCount).getCatshours() returns BigDecimal. We can not add int and BigDecimal. For resolving the issue I need to convert wdContext.nodeI_Catsdbcomm().getI_CatsdbcommElementAt(iCount).getCatshours() into integer. How we can do so?

Regards,

Gary

	int sumHours=0;

	  sumHours = sumHours + wdContext.nodeI_Catsdbcomm().getI_CatsdbcommElementAt(iCount).getCatshours();

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Gary,

The BigDecimal class has a method intValue(). So use

....).getCatshours().intValue();

See also [BigDecimal|http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigDecimal.html]

Hope this helps.

Regrads,

Alain

Answers (0)