String dataDir = Paths.get(Utils.getSharedDataDir(LoadPasswordProtectedOneNoteDoc.class), "load").toString();

        Document ref[] = { null };
        if (!Document.isEncrypted(Paths.get(dataDir, "Sample1.one").toString(), "VerySecretPassword", ref))
        {
            if (ref[0] != null)
            {
                System.out.println("The document is decrypted. It is loaded and ready to be processed.");
            }
            else
            {
                System.out.println("The document is encrypted. Invalid password was provided.");
            }
        }
        else
        {
            System.out.println("The document is NOT encrypted. It is loaded and ready to be processed.");
        }