private String generateFileName() {
    int checksum = 1;

    Set<TypeId<?>> typesKeySet = types.keySet();
    Iterator<TypeId<?>> it = typesKeySet.iterator();
    int[] checksums = new int[typesKeySet.size()];
    int i = 0;

    while (it.hasNext()) {
      TypeId<?> typeId = it.next();
      TypeDeclaration decl = getTypeDeclaration(typeId);
      Set<MethodId> methodSet = decl.methods.keySet();
      if (decl.supertype != null) {
        int sum = 31 * decl.supertype.hashCode() + decl.interfaces.hashCode();
        checksums[i++] = 31 * sum + methodSet.hashCode();
      }
    }
    Arrays.sort(checksums);

    for (int sum : checksums) {
      checksum *= 31;
      checksum += sum;
    }

    return "Generated_" + checksum + ".jar";
  }
Generates a dex file and returns its bytes.
android/android_framework/dex-maker/src/main/java/com/android/dx/DexMaker.java