Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2006

Tip: Looking for answers? Try searching our database.

integer to BigInteger

Thread view: 
Jeremy Watts - 06 Nov 2006 21:19 GMT
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...
Daniel Pitts - 06 Nov 2006 21:38 GMT
> 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...

http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigInteger.html#valueOf(long)

Google is your friend.
Ed Webb - 06 Nov 2006 22:15 GMT
> 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!
Daniel Pitts - 07 Nov 2006 00:30 GMT
> > 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
[quoted text clipped - 3 lines]
>
> 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.
Simon Brooke - 07 Nov 2006 10:19 GMT
>> 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()); ?

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

Signature

simon@jasmine.org.uk (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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.