Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

bit conversion

public class BinDec{
public static void main(String argv[]){
        System.out.println(Integer.parseInt("11",2));
        System.out.println(Integer.toString(64,2));
        }
}
I ran above program from link
http://www.jchq.net/certkey/0503certkey.htm
got output like
3
1000000


I did not understand how I got this output.

Any ideas, resources,sample code,links,  highly appreciated. thanks in advance.
Avatar of for_yan
for_yan
Flag of United States of America image

In the first case you parse integer written as 11 in binary system.
11 in binary system is 3

In toString(64,2) case it  in fact says present number 64 in binary system
and that would be 1000000

So the output looks quite understandable

SOLUTION
Avatar of Am P
Am P
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gudii9

ASKER

>>>In the first case you parse integer written as 11 in binary system.
11 in binary system is 3

In toString(64,2) case it  in fact says present number 64 in binary system

why there is " " for 11 where as not present for 64.

where it says present number 64 in binary system. please advise
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial