Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8152237

Support BigInteger.TWO

XMLWordPrintable

    • b112

      BigInteger.valueOf(2) is a common BigInteger value used in binary and cryptography calculation. The BigInteger.TWO is not export, and hence BigInteger.valueOf(2) is used instead. The export BigInteger.TWO can improve a performance and easy the code a little bit.

      The following command can be used to find the use of BigInteger.valueOf(2) in JDK repositories.
      $ find . -type f | xargs grep "BigInteger.valueOf(2)"

      Maybe nice to export BigInteger.TWO in JDK 9.

      - /**
      - * The BigInteger constant two. (Not exported.)
      - */
      - private static final BigInteger TWO = valueOf(2);

      + /*
      + * The BigInteger constant two.
      + *
      + * @since 9
      + */
      + public static final BigInteger TWO = valueOf(2);

            xuelei Xuelei Fan
            xuelei Xuelei Fan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: