public static void main(String[] args) throws IOException {
    if (args.length < 2) {
      printUsage();
      return;
    }

    Dex[] dexes = new Dex[args.length - 1];
    for (int i = 1; i < args.length; i++) {
      dexes[i - 1] = new Dex(new File(args[i]));
    }
    Dex merged = new DexMerger(dexes, CollisionPolicy.KEEP_FIRST, new DxContext()).merge();
    merged.writeTo(new File(args[0]));
  }
minimum number of wasted bytes before it's worthwhile to compact the result
android/android_framework/dex-maker/src/main/java/com/android/dx/merge/DexMerger.java