A Bluetoothenabled oximeter which is a device used to measur
     A Bluetooth-enabled oximeter, which is a device used to measure the oxygen level (SpO2) in the blood and Heart Rate (HR), transmits the SpO2 and HR measurements through three bytes of data once per second to a Bluetooth-enabled microcontroller (See Figure 1). The three bytes contain the 7 bits of SpO2 (SP_0 to SP_6) and the 9 bits of HR (HR_0 to HR_8) as shown in Figure 2. Bits \'X\' are used for something else.  Assuming that a \'C\' code has three variables B1, B2 and B3 declared as unsigned char in a main function and are used to hold the three bytes, byte 1, byte 2 and byte 3 received by the microcontroller respectively. Write the code that can be used to extract the measurements SpO2 and HR from the three received bytes. 
  
  Solution
public byte[] readBytes(InputStream inputStream, int length) throws IOException { byte[] data = new byte[length]; int len = inputStream.read(data); if (len != length) { throw new IOException(\"Read the end of stream.\"); } byte[] headerData = readBytes(inputStream, 9); public class ByteWriter { private final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); public void writeBytes(byte[] data) { try { outputStream.write(data); } catch (IOException ex) { ex.printStackTrace(); } } public byte[] getBytes() { return outputStream.toByteArray(); } } return data; }
