private static int compareClassNames(String a, String b) {
    // Ensure inner classes sort second
    a = a.replace('$', '0');
    b = b.replace('$', '0');

    /*
     * Assuming "package-info" only occurs at the end, ensures package-info
     * sorts first.
     */
    a = a.replace("package-info", "");
    b = b.replace("package-info", "");

    return a.compareTo(b);
  }
Sorts java class names such that outer classes preceed their inner classes and "package-info"
preceeds all other classes in its package.

@param a {@code non-null;} first class name
@param b {@code non-null;} second class name
@return {@code compareTo()}-style result
android/android_framework/dex-maker/src/main/java/com/android/dx/cf/direct/ClassPathOpener.java