Skip to content

Commit 3b3aacd

Browse files
committed
docs: added comments on bit masking
1 parent b6add13 commit 3b3aacd

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/main/java/algorithms/sorting/radixSort/RadixSort.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class RadixSort {
1717
* @return The value of the digit in the number at the given segment.
1818
*/
1919
private static int getSegmentMasked(int num, int segment) {
20+
// Bit masking here to extract each segment from the integer.
2021
int mask = ((1 << NUM_BITS) - 1) << (segment * NUM_BITS);
2122
return (num & mask) >> (segment * NUM_BITS);
2223
}

0 commit comments

Comments
 (0)