code: public static File getTempDir() {
          final String str = System.getProperty(TEMP_DIR_KEY);
          if (str == null) {
              throw new IllegalStateException("System property '" + TEMP_DIR_KEY + "' not found!");
          }
          final String tempDirStr = str.trim();
          if (tempDirStr.length() == 0) {
              throw new IllegalStateException("System property '" + TEMP_DIR_KEY + "' is empty!");
          }
          final File dir = new File(tempDirStr);
          try {
              checkValidDir(dir);
          } catch (final IllegalArgumentException ex) {
              throw new IllegalStateException("System property '" + TEMP_DIR_KEY + "' is not valid! [" + ex.getMessage() + "]");
          }
          return dir;
      }
docs: Returns the temporary directory and checks if it is valid and exists. If not a <code>IllegalStateException</code> is thrown.
  
  @return Directory.