public static void writeArrayLength(int len, DataOutput out) throws IOException {
    if (len == -1) {
      out.writeByte(StaticSerialization.NULL_ARRAY);
    } else if (len <= StaticSerialization.MAX_BYTE_ARRAY_LEN) {
      out.writeByte(len);
    } else if (len <= 0xFFFF) {
      out.writeByte(StaticSerialization.SHORT_ARRAY_LEN);
      out.writeShort(len);
    } else {
      out.writeByte(StaticSerialization.INT_ARRAY_LEN);
      out.writeInt(len);
    }
  }
For backward compatibility this method should be used to invoke fromData on a DSFID or
DataSerializable. It will invoke the correct fromData method based on the class's version
information. This method does not read information about the class of the object. When
serializing use the method invokeToData to write the contents of the object.

@param deserializableObject the object to write
@param in the input stream.
geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java