code: public File extractLibrary(String libraryName, String dirName) throws IOException {
      File javaLibPath = new File(System.getProperty("java.library.path"));
      for (String sourcePath : platformNames(libraryName)) {
        InputStream cinput;
        try {
          cinput = readFile(sourcePath);
        } catch (FileNotFoundException fnfe) {
          // attempt to fallback to file at java.library.path location
          File file = new File(javaLibPath, sourcePath);
          if (file.exists()) return file;
          continue; // otherwise try the next variant in the source path
        }
  
        String sourceCrc = crc(cinput);
        if (dirName == null)
          dirName = sourceCrc;
  
        File extractedDir = new File(System.getProperty("java.io.tmpdir") + "/playn" +
                                     System.getProperty("user.name") + "/" + dirName);
        File extractedFile = new File(extractedDir, new File(sourcePath).getName());
        String extractedCrc = null;
        if (extractedFile.exists()) {
          try {
            extractedCrc = crc(new FileInputStream(extractedFile));
          } catch (FileNotFoundException ignored) {
          }
        }
  
        // if file doesn't exist or the CRC doesn't match, extract it to the temp dir
        if (extractedCrc == null || !extractedCrc.equals(sourceCrc)) {
          extractedDir.mkdirs();
          copyTo(sourcePath, extractedFile);
          // a hack to cope with Mac OS Java dropping support for .jnilib files
          if (sourcePath.endsWith(".jnilib")) {
            String hackPath = sourcePath.replaceAll(".jnilib", ".dylib");
            copyTo(sourcePath, new File(extractedDir, new File(hackPath).getName()));
          }
        }
  
        return extractedFile;
      }
      throw new FileNotFoundException("Unable to find shared lib for '" + libraryName + "'");
    }
docs: Extracts the specified library into the specified temp directory (if it has not already been
  extracted thereto, or if the CRC does not match).
  @param libraryName The library to extract from the classpath or JAR.
  @param dirName The name of the subdirectory where the file will be extracted. If null, the
  file's CRC will be used.
  @return The extracted file.