This week's book giveaway is in the OCAJP 8 forum.We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!See this thread for details.
Big Moose Saloon
 Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies Register / Login Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!

# Integer.parsInt() method and allowed values of radix..

Bindu Lakhanpal
Ranch Hand

Joined: Oct 17, 2008
Posts: 171

public static int parseInt(String s,
throws NumberFormatException

output: 411787

I could not understand the output. i.e.
2.How can we decide what would be printed, if we take a radix 19 or 24.
3.what cab be allowed values for String argument if we take a radix, say 34.
Punit Singh
Ranch Hand

Joined: Oct 16, 2008
Posts: 952

SCJP 6
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9435

20

If you set the radix to the max i.e. 36, then the resulting Number system would have this sequence of digits (you can say it as the primary parts of a number system or something like 0-9 in decimal system are the basic parts which can be combined to form say one hundred and fifty as 150)

0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ

And suppose you take radix as 27, then the allowed values will be

0123456789ABCDEFGHIJKLMNOPQ

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Punit Singh
Ranch Hand

Joined: Oct 16, 2008
Posts: 952

Ohhhhh my god, It will surely out of course, this is not SCJP question, this is Mathematics question. If they want to ask such question than there should be another exam like SCJP Maths-310-M65.
Bindu Lakhanpal
Ranch Hand

Joined: Oct 17, 2008
Posts: 171

Thank you so much Punit and Ankit .Its nice to have a feeling that your doubts will get cleared as soon as possible here.
Punit Singh
Ranch Hand

Joined: Oct 16, 2008
Posts: 952
Your doubts are our doubt also Daisy, it helps us in learning and elaborating new concepts.
Himanshu Gupta
Ranch Hand

Joined: Aug 18, 2008
Posts: 598

Nice explanation Punit.

My Blog SCJP 5 SCWCD 5
Dhruva Mistry
Ranch Hand

Joined: Nov 21, 2008
Posts: 67

Ankit Garg wrote:If you set the radix to the max i.e. 36, then the resulting Number system would have this sequence of digits (you can say it as the primary parts of a number system or something like 0-9 in decimal system are the basic parts which can be combined to form say one hundred and fifty as 150)

0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ

And suppose you take radix as 27, then the allowed values will be

0123456789ABCDEFGHIJKLMNOPQ

thanks for clearing my doubts too!!! i got the key of this matter

Dhruva
Ruben Soto
Ranch Hand

Joined: Dec 16, 2008
Posts: 1032
I was born a mutant and I have 18 fingers in each hand, so for me this is second nature (unnature.) I pity you, mortals.

All code in my posts, unless a source is explicitly mentioned, is my own.
Dhruva Mistry
Ranch Hand

Joined: Nov 21, 2008
Posts: 67

Ruben Soto wrote:I was born a mutant and I have 18 fingers in each hand, so for me this is second nature (unnature.) I pity you, mortals.

:roll:

Ruben Soto
Ranch Hand

Joined: Dec 16, 2008
Posts: 1032
Thank you for sharing your healthy sense of humor with us, Dhruva!

RuBeN

I agree. Here's the link: http://aspose.com/file-tools

subject: Integer.parsInt() method and allowed values of radix..