code: public static void writeSourceToFile(Class<?> koanClass, String newSource) {
          Path currentRelativePath = Paths.get("");
          String workingDirectory = currentRelativePath.toAbsolutePath().toString();
  
          String packagePath = koanClass.getPackage().getName();
          packagePath = packagePath.replace(PACKAGE_SEPARATOR, PATH_SEPARATOR);
  
          String className = koanClass.getSimpleName();
  
          File file =  new File(workingDirectory + KOAN_JAVA_PATH + packagePath + PATH_SEPARATOR + className + JAVA_EXTENSION);
  
          try {
              FileWriter fw = new FileWriter(file.getAbsoluteFile());
              BufferedWriter bw = new BufferedWriter(fw);
              bw.write(newSource);
              bw.close();
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
docs: Write source to file.
  
  @param koanClass the koan class
  @param newSource the source code to be written