--- old/src/share/classes/java/util/BitSet.java 2014-04-22 16:09:15.915344504 +0400 +++ new/src/share/classes/java/util/BitSet.java 2014-04-22 16:09:15.467350137 +0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2014, 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 @@ -1186,10 +1186,12 @@ int i = nextSetBit(0); if (i != -1) { b.append(i); - for (i = nextSetBit(i+1); i >= 0; i = nextSetBit(i+1)) { + while (true) { + if (++i < 0) break; + if ((i = nextSetBit(i)) < 0) break; int endOfRun = nextClearBit(i); do { b.append(", ").append(i); } - while (++i < endOfRun); + while (++i != endOfRun); } }