code: def write_array(self, obj):
          
          classdesc = obj.get_class()
          self._writeStruct(">B", 1, (self.TC_ARRAY,))
          self.write_classdesc(classdesc)
          self._writeStruct(">i", 1, (len(obj),))
  
          # Add reference
          self.references.append(obj)
          logging.debug(
              "*** Adding ref 0x%X for array []",
              len(self.references) - 1 + self.BASE_REFERENCE_IDX,
          )
  
          type_char = classdesc.name[0]
          assert type_char == self.TYPE_ARRAY
          type_char = classdesc.name[1]
  
          if type_char == self.TYPE_OBJECT:
              for o in obj:
                  self._write_value(classdesc.name[1:], o)
          elif type_char == self.TYPE_ARRAY:
              for a in obj:
                  self.write_array(a)
          else:
              log_debug("Write array of type %s" % type_char)
              for v in obj:
                  log_debug("Writing: %s" % v)
                  self._write_value(type_char, v)
docs: Writes a JavaArray
  
          :param obj: A JavaArray object