You are developing a mail service. It is expected to have a method for moving messages into the spam directory. Here it is:
1 public void moveToSpam(String username, File msg) {
2 String pathToSpam = username + File.separator + "spam";
3
4 File spamDirectory = new File(pathToSpam);
5 if (!spamDirectory.exists()) {
6 spamDirectory.mkdir();
7 }
8
9 File spamMsg = new File(pathToSpam + File.separator + msg.getName());
10 __;
11 }
The method checks that ${username}/spam directory exists and then moves the specified file into it.
- username directory is a home directory for a user account;
- spam directory is a directory where spam messages go. It may not exist yet.
After the method's completion spam message should be in ${username}/spam.
Fill the gap in the 10th line to make the method work properly.