BitSet shift Left - Java java.util

Java examples for java.util:BitSet

Description

BitSet shift Left

Demo Code


//package com.java2s;
import java.util.BitSet;

public class Main {
    public static void shiftLeft(BitSet bs, int n) {
        for (int i = bs.length() - 1; i >= 0; i = bs.previousSetBit(i - 1)) {
            bs.clear(i);//from  w  w  w.ja  v a2s  .  c  om
            bs.set(i + 1);
        }
    }
}

Related Tutorials