Java BitSet increment(BitSet bits, int size)

Here you can find the source of increment(BitSet bits, int size)

Description

increment

License

Open Source License

Declaration

public static boolean increment(BitSet bits, int size) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.BitSet;

public class Main {
    public static boolean increment(BitSet bits, int size) {
        int i = size - 1;
        while (i >= 0 && bits.get(i)) {
            bits.set(i--, false);/*from w w w  . j a  v a  2s  .c o  m*/
        }
        if (i < 0) {
            return false;
        }
        bits.set(i, true);
        return true;
    }
}

Related

  1. getSetBitIndices(BitSet bitSet)
  2. hammingDistance(BitSet bs1, BitSet bs2)
  3. hasAtLeastOneBitSet(BitSet bitSet, Iterable indexes)
  4. hex2BitSet(byte[] b, int offset, int maxBits)
  5. hexToBits(String s, BitSet ba, int length)
  6. insertBits(BitSet fromSet, int insertBefore, int count)
  7. intArrToBitSet(ArrayList integerArray)
  8. intToBitSet(int value)
  9. invertInPlace(BitSet bs, int n)