code: @Override
    public void writeExternal(ObjectOutput out) throws IOException {
      out.writeInt(b.length);
      for (double aB : b) {
        out.writeDouble(aB);
      }
    }
docs: The object implements the writeExternal method to save its contents
  by calling the methods of DataOutput for its primitive values or
  calling the writeObject method of ObjectOutput for objects, strings,
  and arrays.
  
  @param out the stream to write the object to