how to convert "BigInteger" into "Integer"? how to print out a BigInteger binary value?

N

nick

1. bitstring=new BigInteger("1010",2);
System.out.print(bitstring);
the print out answer will convert to decimal ,how to print out a binary value?


2.how to convert "BigInteger" into "Integer"?

thanks!
 
E

Eric Sosman

nick said:
1. bitstring=new BigInteger("1010",2);
System.out.print(bitstring);
the print out answer will convert to decimal ,how to print out a binary value?

Look for the toString(int) method in the JavaDoc
for the BigInteger class.
2.how to convert "BigInteger" into "Integer"?

Look for the intValue() method in the JavaDoc for
the BigInteger class.

You're welcome. Elementary questions are more at
home in comp.lang.java.help than here (followups set) --
but even in that group, the fact that you have not
thought to consult the JavaDoc may earn you a certain
amount of well-deserved ridicule. RTFM!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top