Changed bitwise functions to ByteBuffer class to help with errors