static void add(File f, int index) throws FileNotFoundException, IOException {
        File in = new File (ExtractorModel.appDir + "/" + "bookmarks.txt");
        File out = new File(ExtractorModel.appDir + "/" + "tmp.txt");
        out.createNewFile();
        try(FileOutputStream fout = new FileOutputStream(out); 
                PrintWriter pw = new PrintWriter(fout);
                FileInputStream fin = new FileInputStream(in)) {
            
            BufferedReader br = new BufferedReader(new InputStreamReader(fin));
            String s = br.readLine();
            String sink;
            boolean flag = false;
            int hash = hash(f.getName());
            
            while(s != null) {
                StringTokenizer test = new StringTokenizer(s);
                sink = s;
                if(Integer.parseInt(test.nextToken()) == hash) {
                    
                    for(int i = 0; i < 4; i++) {
                        bookmarksIndex[i] = Integer.parseInt(test.nextToken());
                    }
                    
                    sink = "" + hash;
                    if(bookmarksIndex[0] == -1) {
                        bookmarksIndex[0] = index;
                    }
                    else if(bookmarksIndex[1] == -1) {
                        bookmarksIndex[1] = index;
                    }
                    else if(bookmarksIndex[2] == -1) {
                        bookmarksIndex[2] = index;
                    }
                    else {
                        bookmarksIndex[2] = index;
                    }
                    sink += " " + bookmarksIndex[0] + " " + bookmarksIndex[1] +
                            " " + bookmarksIndex[2] + " " + bookmarksIndex[3];
                    flag = true;
                    }
                pw.append(sink + "\n");
                s = br.readLine();
                
            }
            if(!flag) {
                pw.append(hash + " "+ index + " -1 -1 -1\n");
            }
        } 
        in.delete();
        out.renameTo(in);
    }