Java BitSet reverse(final BitSet bitset, final int sizeInBits)

Here you can find the source of reverse(final BitSet bitset, final int sizeInBits)

Description

reverse

License

Apache License

Declaration

public static BitSet reverse(final BitSet bitset, final int sizeInBits) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.BitSet;

public class Main {
    public static BitSet reverse(final BitSet bitset, final int sizeInBits) {
        final BitSet reversed = new BitSet();

        int reversedIndex = 0;
        for (int i = sizeInBits - 1; i >= 0; i--) {
            if (bitset.get(i)) {
                reversed.set(reversedIndex);
            }//from www.ja  v a 2  s  .  co m
            reversedIndex++;

        }
        return reversed;
    }
}

Related

  1. parseBitSet(byte[] sfData, int offset, int length)
  2. pickRandomSetIndexFromBitSet(BitSet bitset)
  3. printBitSet(BitSet bs)
  4. printBitSet(BitSet iBits, int length)
  5. readByte(BitSet bits, int startByte)
  6. reverseBitSet(BitSet bs)
  7. setBitIterator(final BitSet b)
  8. setBits(BitSet bitSet, Iterable indexes)
  9. setBitSet(BitSet bitSet, int x1, int x2, int y, int width)