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

java.util.BitSet.nextClearBit(int) in jdk1.4 returns unexpected value

XMLWordPrintable

    • beta
    • sparc
    • solaris_2.6
    • Verified



      Name: auR10023 Date: 07/03/2000



      java.util.BitSet.nextClearBit(int) in jdk1.4 returns unexpected value.

      See example:

      ------------------example--------------------

       import java.util.*;

       class TestBitSet {

           public static void main(String[] args) {
               BitSet bs = new BitSet();
               for (int i = 0; i < 64; i++) {
                   bs.set(i);
               }
               System.out.println("BitSet:" + bs);
               System.out.println("nextClearBit(0):" +
                                  Integer.toString(bs.nextClearBit(0)));
           }
       }

      -------------------jdk1.4 output ---------------------------
       BitSet:{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
      +26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
      +52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63}
       nextClearBit(0):65
             ^^^^^^^^^^^^^^

      This method should return value 64.

      ======================================================================

            mmcclosksunw Michael Mccloskey (Inactive)
            avusunw Avu Avu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: