changeset 49238:6e6c3a755b89

8199258: BigInteger.bitLength() should explicitly specify behavior when the value is zero Reviewed-by: lancea, rriggs
author bpb
date Tue, 13 Mar 2018 11:49:17 -0700
parents 9552f0648b53
children 63eceefeb347
files src/java.base/share/classes/java/math/BigInteger.java
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/math/BigInteger.java	Tue Mar 13 09:57:44 2018 -0700
+++ b/src/java.base/share/classes/java/math/BigInteger.java	Tue Mar 13 11:49:17 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3556,8 +3556,8 @@
      * Returns the number of bits in the minimal two's-complement
      * representation of this BigInteger, <em>excluding</em> a sign bit.
      * For positive BigIntegers, this is equivalent to the number of bits in
-     * the ordinary binary representation.  (Computes
-     * {@code (ceil(log2(this < 0 ? -this : this+1)))}.)
+     * the ordinary binary representation.  For zero this method returns
+     * {@code 0}.  (Computes {@code (ceil(log2(this < 0 ? -this : this+1)))}.)
      *
      * @return number of bits in the minimal two's-complement
      *         representation of this BigInteger, <em>excluding</em> a sign bit.