You haven't specified, but I'll assume you are talking about Alfresco on-premise. The following will work on-premise or in the cloud but if you are running against Alfresco in the cloud the URL will have your tenant ID instead of "-default-".
If you are looking for the root of the repository and you are using OpenCMIS, you can do:
Folder rootFolder = cmisSession.getRootFolder();
If you are looking for the root folder of a particular Share site, that isn't a CMIS call, that's an Alfresco API call. You do a GET on this URL:
/alfresco/api/-default-/public/alfresco/versions/1/sites/[SOME SITE ID]/containers