Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Java BigInteger long 
 

We can convert the BigInteger value to the long data type and also can covert the long value to the BigInteger with the use of java.math.BigInteger class and its methods.

 

Java BigInteger long

                         

java example program to convert the BigInteger value to long

We can  convert the BigInteger value to the long data type and also can covert the long value to the BigInteger with the use of java.math.BigInteger class and its methods.

BigInteger bi = BigInteger.valueOf(123L);

Above lines of code creates a BigInteger object with the long value "123L" and to convert the BigInteger value to the long type we can use the method longValue() of the BigInteger class.

Long result = (bigInteger1.multiply(bigInteger2)).longValue();

Above lines of code converts the bigInteger1.multiply(bigInteger2), a BigInteger value to the long. In our java example we have converted a result of two BigInteger variables value to a long variable result. Here is the full example source code of BigIntegerLong as follows:

import java.math.BigInteger;
public class BigIntegerLong
{
    public static void main(String[] args
    {
    BigInteger bigInteger1 = new BigInteger ("123456789");
    BigInteger bigInteger2 = new BigInteger ("112334");
    Long result = (bigInteger1.multiply(bigInteger2)).longValue()
    System.out.println("Result(in Long) is  ==> " + result);
    }
}

Output of the example is as follows:

C:\biginteger>javac BigIntegerLong.java

C:\biginteger>java BigIntegerLong
Result(in Long) is ==> 13868394935526

Download Example Source Code

                         

» View all related tutorials
Related Tags: c string data convert integer variable type vi rsa int ria biginteger long to bi e il can var pe

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.