--- jsr166/src/jsr166e/extra/AtomicDoubleArray.java 2011/08/10 02:03:29 1.1 +++ jsr166/src/jsr166e/extra/AtomicDoubleArray.java 2011/10/20 16:33:25 1.2 @@ -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();