very large integer arithmetic implementation

  • (2 Pages)
  • +
  • 1
  • 2

20 Replies - 502 Views - Last Post: 06 December 2012 - 10:07 PM Rate Topic: -----

#16 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8327
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: very large integer arithmetic implementation

Posted 06 December 2012 - 08:06 PM

View Postmastapro, on 06 December 2012 - 05:30 PM, said:

also pbl, that adding code isn't working for me for some reason, i'm getting an arrayindexoutofbounds exception

Post your code :)
Was This Post Helpful? 0
  • +
  • -

#17 mastapro  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 133
  • Joined: 19-September 11

Re: very large integer arithmetic implementation

Posted 06 December 2012 - 08:54 PM

I got it working now, thanks. took a while but i figured it out. thanks for the help. one last thing, how would u go about finding which number had more digits and zero-pad the other number? i figured that would be something simple but my brain isn't cooperating...
Was This Post Helpful? 0
  • +
  • -

#18 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8327
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: very large integer arithmetic implementation

Posted 06 December 2012 - 08:58 PM

That is the beauty of the reversed List suggested by baavgai you simply don't have to care about it
Was This Post Helpful? 0
  • +
  • -

#19 mastapro  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 133
  • Joined: 19-September 11

Re: very large integer arithmetic implementation

Posted 06 December 2012 - 09:11 PM

Yea I used his technique of reversing the binary number but I'm still getting problems when I try 2 numbers that aren't the same length. I'm not using a list because I find an array is easier to understand so I'm trying to implement it this way, i think it only works when i pad the zeroes so both numbers are the same length
Was This Post Helpful? 0
  • +
  • -

#20 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8327
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: very large integer arithmetic implementation

Posted 06 December 2012 - 09:20 PM

View Postmastapro, on 07 December 2012 - 12:11 AM, said:

I'm not using a list because I find an array is easier to understand

If you say so ... you are really looking for problems

I have already suggested a class that extends ArrayList<Integer> and return 0 when you exceed the actual size.. this is a piece of cake to implement and you won't have to worry about size anymore
Was This Post Helpful? 0
  • +
  • -

#21 mastapro  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 133
  • Joined: 19-September 11

Re: very large integer arithmetic implementation

Posted 06 December 2012 - 10:07 PM

well, of course u are correct pbl haha. i just went thru it and fixed some stuff up. appreciate the help. merci
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2