@@ -96,10 +96,10 @@ of terms of different frequencies all small.
96
96
- What's currently there is just a null encoder that takes docIDs as int's and
97
97
writes bytes.
98
98
99
- ### Some reminders/teachings
99
+ ### Some reminders/teachings on bytes and bitwise operations
100
100
101
- You may not have every seen or used much stuff to do byte or bit level
102
- processing in Java . So here are a few pointers:
101
+ You may not have ever seen or used much operations in Java for byte or bit level
102
+ processing. So here are a few pointers.
103
103
104
104
Java supports hexadecimal and binary constants: ` 0xFC ` or ` 0b1100 ` .
105
105
@@ -119,7 +119,7 @@ will treat a `byte` as unsigned, e.g. `Byte.toUnsignedInt(byte)`.
119
119
Java has bit manipulation operators basically like C, which operate on
120
120
the primitive types. That is, you have &, |, ^, and ~ for bitwise and,
121
121
or, xor, and binary ones complement. There are also bit shift operators: <<, >>,
122
- and >>> for left shift, right shift, and a zero filling right shift
122
+ and >>> for left shift, right shift, and a zero- filling right shift
123
123
respectively. The & operator is especially
124
124
useful for masking (selecting out part of a byte or int and the |
125
125
operator is especially useful for combining two numbers that each
@@ -129,12 +129,12 @@ place bytes in the right place in a number. Something like:
129
129
130
130
There are also a few other classes that are highly useful:
131
131
132
- * The ` BitSet ` class efficiently stores an arbitrarily size array of
132
+ * The ` BitSet ` class efficiently stores an arbitrary- size array of
133
133
bits. It's very convenient for working with bits and you can then
134
134
output what you build as a native Java array.
135
135
* A ` byte[] ` is the basic structure for having an array of bytes that
136
136
you work with by yourself.
137
- * A ` ByteArrayOutputStream ` will allow you to write date using I/O
137
+ * A ` ByteArrayOutputStream ` will allow you to write data using I/O
138
138
methods that is written to a growable byte array. You can get that
139
139
array at the end of writing with the ` toByteArray() ` method.
140
140
* The reverse is a ` ByteArrayInputStream ` , which you initialize with a
0 commit comments