Question: If you prefer using base 10 for the Int() class (its much easier to convert these to and from strings, for example), you may consider

If you prefer using base 10 for the Int() class (its much easier to convert these to and from strings, for example), you may consider using base 1 billion. A number in this base can be written as

an 1000000000n + an1 1000000000n1 + . . . + a1 10000000001 + a0 10000000000

where each ai is an integer between 0 and 999999999. The array (or list) of ints which hold the digits can store a number in this range. The size of this data structure will clearly be much smaller. Conversion between base 1 billion and base 10 is easy because 1 billion = 109 . You may also consider using an array (or list) of type long, using as your base the maximum power of 10 which does not exceed the maximum positive long value 263 1.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!