Java examples for java.util:BitSet
from Bit Set to byte array
//package com.java2s; import java.util.BitSet; public class Main { public static byte[] fromBitSet(BitSet bits) { byte[] b = new byte[1]; for (int i = 0; i < bits.length(); i++) { if (bits.get(i) == true) b[0] |= 1 << i;//w w w .j a v a 2 s. co m } return b; } }