forked from lemire/javaewah
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.java
More file actions
40 lines (38 loc) · 1.42 KB
/
example.java
File metadata and controls
40 lines (38 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import javaewah.EWAHCompressedBitmap;
public class example {
public static void main(String[] args) {
EWAHCompressedBitmap ewahBitmap1 = new EWAHCompressedBitmap();
EWAHCompressedBitmap ewahBitmap2 = new EWAHCompressedBitmap();
ewahBitmap1.set(0);
ewahBitmap1.set(2);
ewahBitmap1.set(64);
ewahBitmap1.set(1 << 30);
System.out.println("bitmap 1:");
for (int k : ewahBitmap1)
System.out.println(k);
ewahBitmap2.set(1);
ewahBitmap2.set(3);
ewahBitmap2.set(64);
ewahBitmap2.set(1 << 30);
System.out.println("bitmap 2:");
for (int k : ewahBitmap2)
System.out.println(k);
System.out.println();
System.out.println("bitmap 1 OR bitmap 2:");
EWAHCompressedBitmap orbitmap = ewahBitmap1.or(ewahBitmap2);
for (int k : orbitmap)
System.out.println(k);
System.out.println("memory usage: " + orbitmap.sizeInBytes() + " bytes");
System.out.println();
System.out.println("bitmap 1 AND bitmap 2:");
EWAHCompressedBitmap andbitmap = ewahBitmap1.and(ewahBitmap2);
for (int k : andbitmap)
System.out.println(k);
System.out.println("memory usage: " + andbitmap.sizeInBytes() + " bytes");
System.out.println("bitmap 1 XOR bitmap 2:");
EWAHCompressedBitmap xorbitmap = ewahBitmap1.xor(ewahBitmap2);
for (int k : xorbitmap)
System.out.println(k);
System.out.println("memory usage: " + andbitmap.sizeInBytes() + " bytes");
}
}