code: public static String extractAccountIdFromObjectKey(String objectKey) {
          if (objectKey == null) {
              return null;
          }
  
          int start = objectKey.lastIndexOf(FORWARD_SLASH);
  
          if (start != -1) {
              int end = objectKey.indexOf(UNDER_SCORE, start + FORWARD_SLASH.length());
  
              if (end != -1) {
                  return objectKey.substring(start + FORWARD_SLASH.length(), end);
              }
          }
          return null;
      }
docs: Extract the account ID from an S3 object key.
  <p>
  For example:
  <pre>
  input: https://s3-us-west-2.amazonaws.com/mybucket/AWSLogs/123456789012/CloudTrail/us-east-1/2014/02/14/123456789012_CloudTrail_us-east-1_20140214T2230Z_K0UsfksWvF8TBJZy.json.gz
  output: 1234567890
  </pre>
  
  @param objectKey The object key to query.
  @return the account ID used to access the object.