Java methods to work with bits