class BitSetUtils {

  public static List<Boolean> toList(BitSet bitset, int n) {
    if (n < 0) {
      throw new IllegalArgumentException("Size of list must not be negative but was + " + n);
    }
    List<Boolean> list = new ArrayList<>(n);
    for (int i = 0; i < n; i++) {
      list.add(bitset.get(i));
    }
    return list;
  }

  private  BitSetUtils();

}