# Thread: Need some help understanding Parsing

1. Member
Join Date
Jul 2011
Posts
7
Rep Power
0

## Need some help understanding Parsing

i have this particular code

public class Numbers{
public static void main(String args[]){

Integer x =Integer.valueOf(9);
Double c = Double.valueOf(5);
Float a = Float.valueOf("80");

System.out.println(x);
System.out.println(c);
System.out.println(a);
System.out.println(b);
}
}

after execution it gives the outputs

9
5.0
80.0
1092

Could anyone explain how "1092" comes up after execution of "Integer b = Integer.valueOf( "444",16);" how does it parse the argument "444" ?

Thank you.

2. Senior Member
Join Date
Nov 2010
Posts
210
Rep Power
4
You specified the radix as 16. Since hexadecimal 444 is equal to decimal 1092, that's what it displays.

3. Member
Join Date
Jul 2011
Posts
7
Rep Power
0
Thank you. that is understood..but radix could be any number.. let say radix=20..will it affect the output ?

4. Originally Posted by mcfer
Thank you. that is understood..but radix could be any number.. let say radix=20..will it affect the output ?
Yup, if the radix is 20 the number 444 represents 4*(20*20)+4*(20)+4 == 1684

kind regards,

Jos

5. Member
Join Date
Jul 2011
Posts
7
Rep Power
0
Thank you...

6. will it affect the output
Write a short test program and try different values and see.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•