Operating with Big Decimal Values

// Create via a string
BigDecimal bd1 = new BigDecimal("123456789.0123456890");

// Create via a long
BigDecimal bd2 = BigDecimal.valueOf(123L);

bd1 = bd1.add(bd2);
bd1 = bd1.multiply(bd2);
bd1 = bd1.subtract(bd2);
bd1 = bd1.divide(bd2, BigDecimal.ROUND_UP);
bd1 = bd1.negate();

Comments

12 Oct 2010 - 8:30am by Anonymous (not verified)

If you have 24 zeros after the decimal point what would it be called

21 Feb 2011 - 11:03pm by Prashanth (not verified)

Thank you.

6 Jun 2011 - 4:43am by Vinnie (not verified)

Thank God! Someone with brains sepkas!

6 Jun 2011 - 9:57am by Disney (not verified)

Hey, you’re the goto expert. Thanks for hagnnig out here.

22 Nov 2011 - 3:55am by Anonymous (not verified)

dfgdf

4 Jan 2012 - 4:52am by Anonymous (not verified)

yo yo yo"> im just asking how to say !!!

4 Jan 2012 - 4:53am by Anonymous (not verified)

yo yo yo"> im just asking how to say !!!>>ipT>ipT>ipT>ipT>

4 Jan 2012 - 4:54am by Anonymous (not verified)

yo yo yo"> im just asking how to say !!!<< Scr>Scr>ipT>ipT>ipT>ipT>

4 Jan 2012 - 4:55am by Anonymous (not verified)

yo yo yo"> im just asking how to say !!!<< Scr>ipT>ipT>ipT>ipT>

17 Mar 2012 - 5:20pm by loans (not verified)

I had a dream to begin my own organization, but I didn't have enough of cash to do that. Thank heaven my close friend recommended to use the personal loans. Thus I took the commercial loan and made real my dream.

Post a comment

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.