import java.io.File; import java.security.AccessController; import java.security.PrivilegedAction; public class Main { static long getLastModified(final File f) { return ((Long) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Long(f.lastModified()); } })).longValue(); } }