code: public synchronized static void write(int fd, byte[] data, int offset, int length) throws IOException {
  
          // we make a copy of the data argument because we don't want to modify the original source data
          byte[] buffer = new byte[length];
          System.arraycopy(data, offset, buffer, 0, length);
  
          // write the buffer contents to the serial port via JNI native method
          write(fd, buffer, length);
      }
docs: <p>Sends an array of bytes to the serial port/device identified by the given file descriptor.</p>
  
  @param fd
  The file descriptor of the serial port/device.
  @param data
  A ByteBuffer of data to be transmitted.
  @param offset
  The starting index (inclusive) in the array to send from.
  @param length
  The number of bytes from the byte array to transmit to the serial port.