code: static public int doubleToBytes(double s, byte[] buffer, int index) {
          long bits = Double.doubleToRawLongBits(s);
          int length = longToBytes(bits, buffer, index);
          return length;
      }
docs: This function converts a double into its corresponding byte format and inserts
  it into the specified buffer at the specified index.
  
  @param s The double to be converted.
  @param buffer The byte array.
  @param index The index in the array to begin inserting bytes.
  @return The number of bytes inserted.