Class[] interfaces = cl.getInterfaces (); Arrays.sort (interfaces, interfaceComparator); for (int i=0; i < interfaces.length; i++) data_out.writeUTF (interfaces[i].getName ());
if (! cl.isArray ()) { Class[] interfaces = cl.getInterfaces (); Arrays.sort (interfaces, interfaceComparator); for (int i=0; i < interfaces.length; i++) data_out.writeUTF (interfaces[i].getName ()); }
  private void setUID (Class cl)  {    try    {      Field suid = cl.getDeclaredField ("serialVersionUID");      int modifiers = suid.getModifiers ();      if (Modifier.isStatic (modifiers)	  && Modifier.isFinal (modifiers))      {	uid = getDefinedSUID (cl);	return;      }    }    catch (NoSuchFieldException ignore)    {}    // cl didn't define serialVersionUID, so we have to compute it    try    {      MessageDigest md = null;      DigestOutputStream digest_out = null;      DataOutputStream data_out = null;      try 	{	  md = MessageDigest.getInstance ("SHA");	}      catch (NoSuchAlgorithmException e)	{	  // If a provider already provides SHA, use it; otherwise, use this.	  Gnu gnuProvider = new Gnu();	  Security.addProvider(gnuProvider);	  md = MessageDigest.getInstance ("SHA");	}      digest_out = new DigestOutputStream (nullOutputStream, md);      data_out = new DataOutputStream (digest_out);      data_out.writeUTF (cl.getName ());      int modifiers = cl.getModifiers ();      // just look at interesting bits      modifiers = modifiers & (Modifier.ABSTRACT | Modifier.FINAL  				| Modifier.INTERFACE | Modifier.PUBLIC);      data_out.writeInt (modifiers);      Class[] interfaces = cl.getInterfaces ();      Arrays.sort (interfaces, interfaceComparator);      for (int i=0; i < interfaces.length; i++)	data_out.writeUTF (interfaces[i].getName ());      Field field;      Field[] fields = cl.getDeclaredFields ();      Arrays.sort (fields, memberComparator);      for (int i=0; i < fields.length; i++)      {	field = fields[i];	modifiers = field.getModifiers ();	if (Modifier.isPrivate (modifiers)	    && (Modifier.isStatic (modifiers)		 || Modifier.isTransient (modifiers)))	  continue;	data_out.writeUTF (field.getName ());	data_out.writeInt (modifiers);	data_out.writeUTF (TypeSignature.getEncodingOfClass (field.getType ()));      }      // write class initializer method if present      boolean has_init;      try      {	has_init = hasClassInitializer (cl);      }      catch (NoSuchMethodError e)      {	has_init = false;      }      if (has_init)      {	data_out.writeUTF ("<clinit>");	data_out.writeInt (Modifier.STATIC);	data_out.writeUTF ("()V");      }      Constructor constructor;      Constructor[] constructors = cl.getDeclaredConstructors ();      Arrays.sort (constructors, memberComparator);      for (int i=0; i < constructors.length; i++)      {	constructor = constructors[i];	modifiers = constructor.getModifiers ();	if (Modifier.isPrivate (modifiers))	  continue;	data_out.writeUTF ("<init>");	data_out.writeInt (modifiers);	// the replacement of '/' with '.' was needed to make computed	// SUID's agree with those computed by JDK	data_out.writeUTF (	  TypeSignature.getEncodingOfConstructor (constructor).replace ('/','.'));      }      Method method;      Method[] methods = cl.getDeclaredMethods ();      Arrays.sort (methods, memberComparator);      for (int i=0; i < methods.length; i++)      {	method = methods[i];	modifiers = method.getModifiers ();	if (Modifier.isPrivate (modifiers))	  continue;	data_out.writeUTF (method.getName ());	data_out.writeInt (modifiers);	// the replacement of '/' with '.' was needed to make computed	// SUID's agree with those computed by JDK	data_out.writeUTF (	  TypeSignature.getEncodingOfMethod (method).replace ('/', '.'));      }      data_out.close ();      byte[] sha = md.digest ();      long result = 0;      int len = sha.length < 8 ? sha.length : 8;      for (int i=0; i < len; i++)	result += (long)(sha[i] & 0xFF) << (8 * i);      uid = result;    }    catch (NoSuchAlgorithmException e)    {      throw new RuntimeException ("The SHA algorithm was not found to use in computing the Serial Version UID for class "				  + cl.getName ());    }    catch (IOException ioe)    {      throw new RuntimeException (ioe.getMessage ());    }  }