public static String detectFormat(final String format, final String name) {
        if (FORMAT_AUTODETECT.equals(format)) {
            if (name == null) {
                return FORMAT_FALLBACK;
            }
            final int index = name.lastIndexOf('.');
            if (index == -1) {
                return FORMAT_FALLBACK;
            } else {
                final String ending = name.substring(index + 1).toLowerCase();
                return FORMAT_MAPPING.getOrDefault(ending, FORMAT_FALLBACK);
            }
        } else {
            return format;
        }
    }
Detects the keystore format from the given keystore file name.

@param format The format to base the decision on.
@param name The filename of the keystore.
@return The detected keystore format. If unknown defaults to the systems default.
grpc-common-spring-boot/src/main/java/net/devh/boot/grpc/common/security/KeyStoreUtils.java