using Java how do I convert a long to a BigInteger?

using Java how do I convert a long to a BigInteger?
cgray1223Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
gvasquez95Connect With a Mentor Commented:
Actually, this method from the BigInteger class is straigthforward:

public static BigInteger valueOf(long val)

Available at least from JDK 1.4.2
0
 
VenabiliCommented:
From long to Long to String to BigInteger (using  http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigInteger.html#BigInteger%28java.lang.String%29 ) is one way.

See here for an example:
http://www.codeguru.com/forum/showthread.php?t=359589 (the second post)

Although any conversion from long to String and then followed by conversion to BigInteger will do.
0
 
VenabiliCommented:
Shows when is the last time I used BigInteger - yep, valueOf should do the trick.
0
All Courses

From novice to tech pro — start learning today.