• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Addition of 256bit unsigned integers

 
Chan Lee
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,

I need a help.
Can anyone tell how to add two 256bit/512bit/1024bit unsigned integers in java?
(or)
Can anyone give some idea? please help me.
 
Peter Lawrey
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use BigInteger.
This supports addition and other operations of any precision integers.
 
Chan Lee
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Peter Lawrey:
You can use BigInteger.
This supports addition and other operations of any precision integers.



Thank you Peter, i know that we can use BigIntegers concept. But, I'm unable to get any idea regarding this problem.
 
Campbell Ritchie
Sheriff
Posts: 48378
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look in the API documentation; it is really easy.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12083
29
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a 256-bit number is just a number. The BigInteger class has several constructors that take different objects. How is your number stored? Probably the simplest would be to convert it to a string and use that.
 
Chan Lee
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
r
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"budha",
may have missed that we have a policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do right here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic