Getting confluence username from email

I am creating a custom endpoint in my confluence plugin through which I want to get a user’s username by supplying the email address of the user. I want to send the email as the parameter and want to get the username as the response.
Is there any Java API through which I can get the username of the user?

try this code
`/**

  • @param email

  • @return

  • @see DefaultUserAccessor#getUsersByEmail(String)
    */
    private SearchResult getUsersByEmail(String email) {
    if (!TextUtils.stringSet(email)) {
    return new DefaultSearchResult();
    } else {
    SearchResult<com.atlassian.user.User> results = null;
    EmailTermQuery emailQuery = new EmailTermQuery(email);

     try {
         results = entityQueryParser.findUsers(emailQuery);
         results = ComponentLocator.getComponent(EntityQueryParser.class).findUsers(emailQuery);
     } catch (EntityException var5) {
         log.error(var5.getMessage());
     }
    
     return results;
    

    }
    }`