code: public void write(ByteBuffer... data) throws IllegalStateException, IOException{
          // write each byte buffer to the serial port
          for(ByteBuffer single : data) {
  
              // read the byte buffer from the current position up to the limit
              byte[] payload = new byte[single.remaining()];
              single.get(payload);
  
              write(payload);
          }
      }
docs: Read the content of byte buffer and write the data to the serial port transmit buffer.
  (The buffer is read from the current position up to the 'limit' value, not the 'capacity'.  You may need to
  rewind() or flip() the byte buffer if you have just written to it.)
  
  @param data
  A ByteBuffer of data to be transmitted.