public int numberOfRunsAdjustment() {
    int ans = 0;
    if (BufferUtil.isBackedBySimpleArray(bitmap)) {
      long[] b = bitmap.array();
      long nextWord = b[0];
      for (int i = 0; i < b.length - 1; i++) {
        final long word = nextWord;

        nextWord = b[i + 1];
        ans += ((word >>> 63) & ~nextWord);
      }

      final long word = nextWord;

      if ((word & 0x8000000000000000L) != 0) {
        ans++;
      }

    } else {
      long nextWord = bitmap.get(0);
      int len = bitmap.limit();
      for (int i = 0; i < len - 1; i++) {
        final long word = nextWord;

        nextWord = bitmap.get(i + 1);
        ans += ((word >>> 63) & ~nextWord);
      }

      final long word = nextWord;

      if ((word & 0x8000000000000000L) != 0) {
        ans++;
      }
    }
    return ans;
  }
public int numberOfRunsAdjustment ( ) { int ans = 0 ; if ( BufferUtil . isBackedBySimpleArray ( bitmap ) ) { long [ ] b = bitmap . array ( ) ; long nextWord = b [ 0 ] ; for ( int i = 0 ; i < b . length - 1 ; i ++ ) { final long word = nextWord ; nextWord = b [ i + 1 ] ; ans += ( ( word > > > 63 ) & ~ nextWord ) ; } final long word = nextWord ; if ( ( word & 0x8000000000000000L ) != 0 ) { ans ++ ; } } else { long nextWord = bitmap . get ( 0 ) ; int len = bitmap . limit ( ) ; for ( int i = 0 ; i < len - 1 ; i ++ ) { final long word = nextWord ; nextWord = bitmap . get ( i + 1 ) ; ans += ( ( word > > > 63 ) & ~ nextWord ) ; } final long word = nextWord ; if ( ( word & 0x8000000000000000L ) != 0 ) { ans ++ ; } } return ans ; }
Computes the number of runs

@return the number of runs