public static long serialVersionUID(final ClassEditor ce) {
		// Make sure the class implements Serializable
		if (!SerialVersionUID.implementsSerializable(ce)) {
			final String s = "Class " + ce.name()
					+ " does not implement java.io.Serializable";
			throw new IllegalArgumentException(s);
		}

		// If the class already has a serialVersionUID, return that
		final FieldInfo[] fields = ce.fields();
		for (int i = 0; i < fields.length; i++) {
			final FieldEditor fe = new FieldEditor(ce, fields[i]);
			if (fe.name().equals("serialVersionUID")) {
				final Object value = fe.constantValue();
				if (value != null) {
					if (value instanceof Long) {
						return (((Long) value).longValue());
					}
				}
			}
		}

		// Now, compute the digest of the bytes using SHA
		MessageDigest algorithm = null;
		try {
			algorithm = MessageDigest.getInstance("SHA");

		} catch (final NoSuchAlgorithmException ex) {
			final String s = "Can't use SHA-1 message digest algorith!";
			throw new IllegalArgumentException(s);
		}

		final DataOutputStream dos = new DataOutputStream(
				new DigestOutputStream(new ByteArrayOutputStream(), algorithm));

		try {
			// Write a bunch of information about the class to the output
			// stream
			SerialVersionUID.writeClassName(ce, dos);
			SerialVersionUID.writeClassModifiers(ce, dos);
			SerialVersionUID.writeInterfaceNames(ce, dos);
			SerialVersionUID.writeFields(ce, dos);
			SerialVersionUID.writeStaticInitializer(ce, dos);
			SerialVersionUID.writeConstructors(ce, dos);
			SerialVersionUID.writeMethods(ce, dos);

			dos.flush();
			dos.close();

		} catch (final IOException ex) {
			final String s = ("While computing serial version UID: " + ex);
			throw new IllegalArgumentException(s);
		}

		// Compute the hash value from the first 64 bites of the digest
		final byte[] digest = algorithm.digest();
		long uid = 0;
		for (int i = 0; i < Math.min(8, digest.length); i++) {
			uid += (long) (digest[i] & 255) << (i * 8);
		}
		return (uid);

	}