I'm trying to write Java code to pull the date a user in Active Directory last changed their password in AD.

I am unable to return a value, much less convert it into a readable form.

Not sure about PasswordLastChanged vs pwdLastSet and which I should use... but here is the relevant code so far (I keep getting null pointer exceptions)... Any ideas?

Code:
...

env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");

            //set security credentials, note using simple cleartext authentication
            env.put(Context.SECURITY_AUTHENTICATION,"simple");
            env.put(Context.SECURITY_PRINCIPAL,adminName);
            env.put(Context.SECURITY_CREDENTIALS,adminPassword);

            //specify attributes to be returned in binary format
            env.put("java.naming.ldap.attributes.binary","objectGUID");

            //connect to my domain controller
            env.put(Context.PROVIDER_URL,ldapURL);
            try
            {
                //Create the initial directory context
                LdapContext ctx = new InitialLdapContext(env,null);

                //Create the search controls
                SearchControls searchCtls = new SearchControls();

                //Specify the attributes to return
                // not used: "sn","givenName","description"
                String returnedAtts[]={"sAMAccountName","mail","objectGUID","userPrincipalName","distinguishedName","userAccountControl","name","telephoneNumber","PasswordLastChanged","pwdLastSet"};

                searchCtls.setReturningAttributes(returnedAtts);

                //Specify the search scope
                searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);

                //specify the LDAP search filter
                String searchFilter = "(&(objectClass=user)(sAMAccountName=" + userid +"))";

                //Specify the Base for the search
                String searchBase = ou;

                //initialize counter to total the results
                int totalResults = 0;

                //Search for objects using the filter
                NamingEnumeration answer = ctx.search(searchBase, searchFilter, searchCtls);

                //Loop through the search results
                while (answer.hasMoreElements())
                {
                    SearchResult sr = (SearchResult)answer.next();

                    totalResults++;

                    // Print out some of the attributes, catch the exception if the attributes have no values
                    Attributes attrs = sr.getAttributes();
                    if (attrs != null)
                    {
                        try
                        {
                    return attrs.get("pwdLastSet").get().toString();
                        }
                        catch (Exception e)
                         {
                               return e;
                         }  
...