BigInteger.ONE

Discussion in 'Java' started by au714@osfn.org, Feb 23, 2006.

  1. Guest

    Why does the BigInteger class have a few pre-defined static constants,
    as in ZERO, ONE, and TEN?

    Seems very arbitrary. What is the reasoning behind this in the first
    place?


    FGB
    , Feb 23, 2006
    #1
    1. Advertising

  2. BigIntegers are immutable, therefore it makes sense to share some
    common instances.

    Traditionally, these three numbers crop up rather frequently, so
    offering "shorthand" instances for them makes sense. Even more if you
    consider the "static import" feature of java 1.5 - setBase(TEN) is much
    clearer then setBase(new BigInteger(10))
    Stefan Schulz, Feb 23, 2006
    #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. pete kirkham
    Replies:
    5
    Views:
    458
    pete kirkham
    Aug 13, 2003
  2. xarax
    Replies:
    6
    Views:
    8,602
    xarax
    Sep 8, 2003
  3. David Goulet

    BigInteger

    David Goulet, Jan 25, 2004, in forum: Java
    Replies:
    1
    Views:
    650
  4. nick
    Replies:
    0
    Views:
    893
  5. nick
    Replies:
    1
    Views:
    31,746
    Eric Sosman
    Oct 26, 2004
Loading...

Share This Page