Java BitSet setBits(BitSet bitSet, Iterable indexes)

Here you can find the source of setBits(BitSet bitSet, Iterable indexes)

Description

Set all bits on a given positions.

License

Open Source License

Parameter

Parameter Description
bitSet the BitSet to modify
indexes the index positions to set

Declaration

public static void setBits(BitSet bitSet, Iterable<Integer> indexes) 

Method Source Code


//package com.java2s;
/*//  w w w  . j a va2s  .  co m
 * Copyright (c) 2008-2016, Hazelcast, Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.util.BitSet;

public class Main {
    /**
     * Set all bits on a given positions.
     *
     * @param bitSet  the {@link BitSet} to modify
     * @param indexes the index positions to set
     */
    public static void setBits(BitSet bitSet, Iterable<Integer> indexes) {
        for (Integer index : indexes) {
            bitSet.set(index);
        }
    }
}

Related

  1. printBitSet(BitSet iBits, int length)
  2. readByte(BitSet bits, int startByte)
  3. reverse(final BitSet bitset, final int sizeInBits)
  4. reverseBitSet(BitSet bs)
  5. setBitIterator(final BitSet b)
  6. setBitSet(BitSet bitSet, int x1, int x2, int y, int width)
  7. shiftLeft(BitSet bs, int n)
  8. shiftLeft(BitSet s, int length)
  9. shiftLeft(BitSet src, int offset)