@Test public void testMapToList(){ int[] expectedlist = new int[]{0,0,1,0,0,0,1,1,0,1,1,0,1,0,1,0}; int[] words = new int[]{35,106}; int[] list = BitmapBuilder.mapToList(words); assertArrayEquals(expectedlist,list); }
public static int[] mapToList(int[] bitMap) { int[] list = new int[(int)(bitMap.length * WORD_LENGTH)]; Arrays.fill(list, 0); int j = -1; for (int i = 0; i < list.length; i++) { if (i % WORD_LENGTH == 0) { j++; } list[i] = (bitMap[j] & (1 << ((WORD_LENGTH - 1) - (i % WORD_LENGTH)))) == 0 ? 0 : 1; } return list; }
BitmapBuilder { public static int[] mapToList(int[] bitMap) { int[] list = new int[(int)(bitMap.length * WORD_LENGTH)]; Arrays.fill(list, 0); int j = -1; for (int i = 0; i < list.length; i++) { if (i % WORD_LENGTH == 0) { j++; } list[i] = (bitMap[j] & (1 << ((WORD_LENGTH - 1) - (i % WORD_LENGTH)))) == 0 ? 0 : 1; } return list; } }
BitmapBuilder { public static int[] mapToList(int[] bitMap) { int[] list = new int[(int)(bitMap.length * WORD_LENGTH)]; Arrays.fill(list, 0); int j = -1; for (int i = 0; i < list.length; i++) { if (i % WORD_LENGTH == 0) { j++; } list[i] = (bitMap[j] & (1 << ((WORD_LENGTH - 1) - (i % WORD_LENGTH)))) == 0 ? 0 : 1; } return list; }  }
BitmapBuilder { public static int[] mapToList(int[] bitMap) { int[] list = new int[(int)(bitMap.length * WORD_LENGTH)]; Arrays.fill(list, 0); int j = -1; for (int i = 0; i < list.length; i++) { if (i % WORD_LENGTH == 0) { j++; } list[i] = (bitMap[j] & (1 << ((WORD_LENGTH - 1) - (i % WORD_LENGTH)))) == 0 ? 0 : 1; } return list; }  static int[] listToMap(int[] list); static int[] mapToList(int[] bitMap); }
BitmapBuilder { public static int[] mapToList(int[] bitMap) { int[] list = new int[(int)(bitMap.length * WORD_LENGTH)]; Arrays.fill(list, 0); int j = -1; for (int i = 0; i < list.length; i++) { if (i % WORD_LENGTH == 0) { j++; } list[i] = (bitMap[j] & (1 << ((WORD_LENGTH - 1) - (i % WORD_LENGTH)))) == 0 ? 0 : 1; } return list; }  static int[] listToMap(int[] list); static int[] mapToList(int[] bitMap); static final int WORD_LENGTH; }