Checking Access Rights - Java

Is there any possible way to load a document with a privileged account and check access rights for a specific user using the Java API? Something like checkAccessRights(String userName, Document document)?

Many thanks in advance for your help!