• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

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

 
Ranch Hand
Posts: 171
Flex Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

public static int parseInt(String s,
int radix)
throws NumberFormatException





output: 411787

I could not understand the output. i.e.
1.How to decide the range of radix.( in between Character.MIN_RADIX and Character.MAX_RADIX. given in api)
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.
 
Ranch Hand
Posts: 952
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Character.MIN_RADIX = 2 and Character.MAX_RADIX = 36
 
Sheriff
Posts: 9674
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Punit Singh
Ranch Hand
Posts: 952
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



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
Posts: 171
Flex Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 952
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your doubts are our doubt also Daisy, it helps us in learning and elaborating new concepts.
 
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice explanation Punit.
 
Ranch Hand
Posts: 67
Mac Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
Ranch Hand
Posts: 1032
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Dhruva Mistry
Ranch Hand
Posts: 67
Mac Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 1032
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for sharing your healthy sense of humor with us, Dhruva!

RuBeN
 
And then the entire population worshiped me like unto a god. Well, me and this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic