Java BitSet shiftLeft(BitSet s, int length)

Here you can find the source of shiftLeft(BitSet s, int length)

Description

Shifts bits of a BitSet object one place to the left.

License

Open Source License

Parameter

Parameter Description
s Shifted BitSet object.
length Length of binary number.

Return

BitSet s after shifting.

Declaration

public static BitSet shiftLeft(BitSet s, int length) 

Method Source Code

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

import java.util.BitSet;

public class Main {
    /**//from w w w  .jav  a  2 s .c o m
     * Shifts bits of a BitSet object one place to the left.
     * Stores new value in the same BitSet.
     *
     * @param s Shifted BitSet object.
     * @param length Length of binary number.
     * @return BitSet s after shifting.
     */
    public static BitSet shiftLeft(BitSet s, int length) {
        for (int i = length; i > 0; i--) {
            s.set(i, s.get(i - 1));
        }
        s.set(0, false);

        return s;
    }
}

Related

  1. reverseBitSet(BitSet bs)
  2. setBitIterator(final BitSet b)
  3. setBits(BitSet bitSet, Iterable indexes)
  4. setBitSet(BitSet bitSet, int x1, int x2, int y, int width)
  5. shiftLeft(BitSet bs, int n)
  6. shiftLeft(BitSet src, int offset)
  7. shiftRight(BitSet bitset, int n)
  8. storeCharSet(BitSet stored, String... validCharStrings)
  9. strArrToBitSet(String stringArray)