[java] Create a directory if it does not exist and then create the files in that directory as well