I am reading data from a serial device and several of the fields are alarm fields where the bits on or off indicate the alarm is on or off at that moment.
What is the best approach for determining a bit is on or off and managing something like this in Java? So if bit 1 is on I need to indicate the High outside temp alarm went active. Is this something I would use a collection or ENUM for? Being still new to Java trying to figure out how to do it right or best.
Thanks for the responses and the example. I have not done this kind of thing in C or Assembler. Twiddling bits has not been easy for me so I am learning as I go. I am Googling references on this type of approach to better understand what is going on.
Well either the data I grabbed was wrong or I have something incorrect, probably both. I did find I had to worry about byte order, so the input was actually 0x89b7 and flipped the bytes to 0xb789. Right now the data run is showing 0xffff so waiting for some valid data to make sure I got it right. Trying to create a test format for today's date for testing.