integer to BigInteger

J

Jeremy Watts

how do you convert an integer to BigIntger?? i thought it was just
BigInteger(integer) but its not working... im sure ive done this before
but i cant remember what i did...
 
E

Ed Webb

Jeremy said:
how do you convert an integer to BigIntger?? i thought it was just
BigInteger(integer) but its not working... im sure ive done this before
but i cant remember what i did...

How about BigInteger(integer.toString()); ?

Ed!
 
D

Daniel Pitts

Ed said:
How about BigInteger(integer.toString()); ?

Ed!

Uh, lets think about this.
You have an int.
Wrap it into a Integer object.
Convert the Integer to a String object.
Ask BigInteger to parse the String object;
done.

Versus.
How about BigInteger.valueOf(integer);

You have an int.
Wrap it with a BigInteger object.
done.
 
S

Simon Brooke

Ed Webb said:
How about BigInteger(integer.toString()); ?

Eeeeeww. No. Nonononnonono. Don't even go there.

--
(e-mail address removed) (Simon Brooke) http://www.jasmine.org.uk/~simon/

;; MS Windows: A thirty-two bit extension ... to a sixteen bit
;; patch to an eight bit operating system originally coded for a
;; four bit microprocessor and sold by a two-bit company that
;; can't stand one bit of competition -- anonymous
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top