public static String guessRegionNameForEndpointWithDefault(String hostname, String serviceHint, String defaultRegion) {
        String region = guessRegionNameForEndpoint(hostname, serviceHint);
        return region != null ? region : defaultRegion;
    }
Attempt to convert the provided hostname and service hint into a region name, returning null if the conversion fails.
aws-java-sdk-core/src/main/java/com/amazonaws/regions/EndpointToRegion.java