public boolean isValidUsername(String username){
  return Pattern.matches("^[\\w\\@\\.]+$",username);
}

public boolean isValidUsername ( String username ) { return Pattern . matches ( "^[\\w\\@\\.]+$" , username ) ; }
checks whether the given username is valid
