Here you can find the source of bitsetToDoubleArray(BitSet bs, int n)
Parameter | Description |
---|---|
bs | The bitset specifying 0s and 1s |
n | The size of the array. |
public static double[] bitsetToDoubleArray(BitSet bs, int n)
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.util.BitSet; public class Main { /**// w ww . ja v a 2s. co m * Create an n-element array of doubles (0s and 1s) from a BitSet. * @param bs The bitset specifying 0s and 1s * @param n The size of the array. */ public static double[] bitsetToDoubleArray(BitSet bs, int n) { int i; double res[] = new double[n]; for (i = 0; i < n; i++) res[i] = bs.get(i) ? 1.0 : 0.0; return res; } }