String dir = "/Desktop/";
// Create an object of the FileInputStream class to obtain input bytes from a file in a file system.  
try (FileInputStream fs = new FileInputStream(dir + "sample.rar")) {
    // Initialize a new instance of the RarArchive class with the input stream.  
    RarArchive archive = new RarArchive(fs);
    // Call extractToDirectory method to extract the files in the directory. 
    archive.extractToDirectory(dir + "DecompressRar_out");
} catch (IOException e) {
    e.printStackTrace();
}