integer to BigInteger

Discussion in 'Java' started by Jeremy Watts, Nov 6, 2006.

  1. Jeremy Watts

    Jeremy Watts Guest

    how do you convert an integer to BigIntger?? i thought it was just
    BigInteger(integer) but its not working... im sure ive done this before
    but i cant remember what i did...
     
    Jeremy Watts, Nov 6, 2006
    #1
    1. Advertising

  2. Jeremy Watts

    Daniel Pitts Guest

    Daniel Pitts, Nov 6, 2006
    #2
    1. Advertising

  3. Jeremy Watts

    Ed Webb Guest

    Jeremy Watts wrote:
    > how do you convert an integer to BigIntger?? i thought it was just
    > BigInteger(integer) but its not working... im sure ive done this before
    > but i cant remember what i did...
    >
    >


    How about BigInteger(integer.toString()); ?

    Ed!
     
    Ed Webb, Nov 6, 2006
    #3
  4. Jeremy Watts

    Daniel Pitts Guest

    Ed Webb wrote:
    > Jeremy Watts wrote:
    > > how do you convert an integer to BigIntger?? i thought it was just
    > > BigInteger(integer) but its not working... im sure ive done this before
    > > but i cant remember what i did...
    > >
    > >

    >
    > How about BigInteger(integer.toString()); ?
    >
    > Ed!


    Uh, lets think about this.
    You have an int.
    Wrap it into a Integer object.
    Convert the Integer to a String object.
    Ask BigInteger to parse the String object;
    done.

    Versus.
    How about BigInteger.valueOf(integer);

    You have an int.
    Wrap it with a BigInteger object.
    done.
     
    Daniel Pitts, Nov 7, 2006
    #4
  5. Jeremy Watts

    Simon Brooke Guest

    in message <euO3h.2371$>, Ed Webb
    ('') wrote:

    > Jeremy Watts wrote:
    >> how do you convert an integer to BigIntger?? i thought it was just
    >> BigInteger(integer) but its not working... im sure ive done this
    >> before but i cant remember what i did...

    >
    > How about BigInteger(integer.toString()); ?


    Eeeeeww. No. Nonononnonono. Don't even go there.

    --
    (Simon Brooke) http://www.jasmine.org.uk/~simon/

    ;; MS Windows: A thirty-two bit extension ... to a sixteen bit
    ;; patch to an eight bit operating system originally coded for a
    ;; four bit microprocessor and sold by a two-bit company that
    ;; can't stand one bit of competition -- anonymous
     
    Simon Brooke, Nov 7, 2006
    #5
    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:
    938
  2. nick
    Replies:
    1
    Views:
    32,102
    Eric Sosman
    Oct 26, 2004
  3. Jeremy Watts

    converting BigInteger to integer

    Jeremy Watts, Nov 23, 2006, in forum: Java
    Replies:
    1
    Views:
    504
    Eric Sosman
    Nov 23, 2006
  4. Replies:
    1
    Views:
    689
    Fred Kleinschmidt
    Nov 29, 2006
  5. Replies:
    1
    Views:
    16,370
    Hendrik Maryns
    Nov 29, 2006
Loading...

Share This Page