code: public static String createNewBucketName(String accessKeyId,
                                               String spaceId) {
          String bucketName = accessKeyId + "." + spaceId;
          bucketName = bucketName.toLowerCase();
          bucketName = bucketName.replaceAll("[^a-z0-9-.]", "-");
  
          // Remove duplicate separators (. and -)
          while (bucketName.contains("--") || bucketName.contains("..")
                 || bucketName.contains("-.") || bucketName.contains(".-")) {
              bucketName = bucketName.replaceAll("[-]+", "-");
              bucketName = bucketName.replaceAll("[.]+", ".");
              bucketName = bucketName.replaceAll("-[.]", "-");
              bucketName = bucketName.replaceAll("[.]-", ".");
          }
  
          if (bucketName.length() > 63) {
              bucketName = bucketName.substring(0, 63);
          }
          while (bucketName.endsWith("-") || bucketName.endsWith(".")) {
              bucketName = bucketName.substring(0, bucketName.length() - 1);
          }
          return bucketName;
      }
docs: Converts a provided space ID into a valid and unique S3 bucket name.
  
  @param spaceId
  @return