Large numbers in JAVA

Discussion in 'Software' started by slashgonewylde, Dec 10, 2009.

  1. slashgonewylde

    slashgonewylde Private E-2

    I should know how to do this but I totally forget. Very simple program using numbers 4 600 000. I get the "integer number to large" error
     
  2. JJJIrish05

    JJJIrish05 Sergeant

    use long not int
     
  3. XTAL256

    XTAL256 Private First Class

    But 4,600,000 can be stored in a int, it's less than 2^32 (unless you meant to put another 3 zeros on the end of that).

    If you need *very* large integers of arbitrary size that cannot fit into a long, you could always use BigInteger
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds