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

Discussion in 'Java' started by nick, Oct 26, 2004.

  1. nick

    nick Guest

    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!
    nick, Oct 26, 2004
    #1
    1. Advertising

  2. nick

    Eric Sosman Guest

    Re: how to convert "BigInteger" into "Integer"? how to print outa BigInteger binary value?

    nick wrote:
    > 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.

    > thanks!


    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!

    --
    Eric Sosman, Oct 26, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nick
    Replies:
    0
    Views:
    885
  2. Jeremy Watts

    integer to BigInteger

    Jeremy Watts, Nov 6, 2006, in forum: Java
    Replies:
    4
    Views:
    547
    Simon Brooke
    Nov 7, 2006
  3. Replies:
    1
    Views:
    641
    Fred Kleinschmidt
    Nov 29, 2006
  4. Replies:
    1
    Views:
    16,201
    Hendrik Maryns
    Nov 29, 2006
  5. hsun
    Replies:
    4
    Views:
    120
    Simon Kröger
    Aug 31, 2005
Loading...

Share This Page