You have to perform "search" on the DirContext for your filter criteria. Basic way will be to retrieve all the users and check for the group attribute. If it's null then you can print the users without the group.
The efficient way will be to use DirContext.search() by checking for empty group attribute, something like below
memberof is group attribute in your ldap directory.