Using BigInteger in Java to calculate unsigned long value

Posted on 2007-09-30
Medium Priority
Last Modified: 2012-08-13
I need to convert this C# code to Java where __count is a ULong type and STR_LENGTH=8. How do I use BigInteger here.

        static test()
            int index;
            // compute ( 10 ^ STR_LENGTH ) - 1

            __count= 1UL;
            for (index = 0; index < STR_LENGTH; ++index)
                __count*= 10UL;
Question by:azi98
1 Comment

Accepted Solution

maheshexp earned 2000 total points
ID: 19988701
new BigInteger("10").pow( number ).subtract( BigInteger.ONE ) will give you 10^number - 1

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month14 days, 11 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question