private void setFilenames(String filename, char app){
                BufferedReader input0;
                try{
                    input0 = new BufferedReader(new FileReader(filename));
                }catch(FileNotFoundException e){
                    this.fileExists = false;
                }

                if(this.app == 'n'){
                        boolean test = true;
                        int i = 0;
                        BufferedReader input;
                        String ext = "";
                        String filename0 = "";

                        int idot=filename.indexOf('.');
                        if(idot!=-1){
                                ext += filename.substring(idot);
                                filename0 += filename.substring(0,idot);
                        }
                        else{
                                filename0 += filename;
                        }

                        while(test){
                                i++;
                                filename=filename0+String.valueOf(i)+ext;
                                try{
                                        input = new BufferedReader(new FileReader(filename));
                                }catch(FileNotFoundException e){
                                        test=false;
                                        this.filename=filename;
                                }
                        }
                }

                if(this.app == 'a'){
                        this.append=true;
                }
                else{
                        this.append = false;
                }
                try{
                        fwoutput = new FileWriter(filename, this.append);
                }
                catch(IOException e){
                        System.out.println(e);
                }

                this.output = new PrintWriter(new BufferedWriter(fwoutput));
        }