Skip to content
Subhajit Sahu edited this page Jan 17, 2021 · 7 revisions

Gets bits as per mask. 📰 📘

Alternatives: get, getAs.
Similar: get, set, toggle.


Bit.getAs(x, m);
// x: an int or long
// m: bit mask
import io.github.javaf.*;

Bit.getAs(6, 4);
// 4 (110,100 => 100)

Bit.getAs(6, 7);
// 6 (110,111 => 110)

Bit.getAs(6, 5);
// 4 (110,101 => 100)


References

Clone this wiki locally