public static boolean isValidV2BucketName(String bucketName) {
        return isValidV2BucketName(bucketName, false);
    }
Returns true if the specified bucket name can be addressed using V2,
virtual host style, addressing. Otherwise, returns false indicating that
the bucket must be addressed using V1, path style, addressing.

@param bucketName
           The name of the bucket to check.

@return True if the specified bucket name can be addressed in V2, virtual
        host style, addressing otherwise false if V1, path style,
        addressing is required.
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/BucketNameUtils.java