--- jsr166/src/jsr166e/extra/AtomicDoubleArray.java 2011/08/10 02:03:29 1.1 +++ jsr166/src/jsr166e/extra/AtomicDoubleArray.java 2011/10/20 17:47:36 1.3 @@ -20,7 +20,7 @@ import static java.lang.Double.longBitsT * which differs from both the primitive double {@code ==} operator * and from {@link Double#equals}, as if implemented by: *
 {@code
- * boolean bitEquals(double x, double y) {
+ * static boolean bitEquals(double x, double y) {
  *   long xBits = Double.doubleToRawLongBits(x);
  *   long yBits = Double.doubleToRawLongBits(y);
  *   return xBits == yBits;
@@ -162,7 +162,9 @@ public class AtomicDoubleArray implement
      * if the current value is bitwise equal
      * to the expected value.
      *
-     * 

May fail spuriously + *

May + * fail spuriously * and does not provide ordering guarantees, so is only rarely an * appropriate alternative to {@code compareAndSet}. * @@ -222,9 +224,10 @@ public class AtomicDoubleArray implement if (iMax == -1) return "[]"; - StringBuilder b = new StringBuilder(); + // Double.toString(Math.PI).length() == 17 + StringBuilder b = new StringBuilder((17 + 2) * (iMax + 1)); b.append('['); - for (int i = 0; ; i++) { + for (int i = 0;; i++) { b.append(longBitsToDouble(getRaw(byteOffset(i)))); if (i == iMax) return b.append(']').toString();