public void createIndexArff(String in, ArrayList<Integer> years) {

        String result = "";
        int instances = 0;
        result += "@RELATION " + in + "\r\n";
        result += "@ATTRIBUTE day NUMERIC " + "\r\n";
        result += "@ATTRIBUTE djia NUMERIC " + "\r\n";
        result += "@ATTRIBUTE nasdaq NUMERIC " + "\r\n";
        result += "@ATTRIBUTE eurostoxx NUMERIC " + "\r\n";
        result += "@ATTRIBUTE dollar NUMERIC " + "\r\n";
        result += "@ATTRIBUTE euro NUMERIC " + "\r\n";
        result += "@ATTRIBUTE gain NUMERIC " + "\r\n";
        result += "@ATTRIBUTE price NUMERIC " + "\r\n";
        result += "@DATA " + "\r\n";
        String indexName = in.toUpperCase();
        for (Integer i : years) {

            try {
                File f = new File("src/datas/indices/" + indexName + "/" + indexName + "_" + i.toString() + ".csv");
                Scanner sc = new Scanner(f);
                String line = "";
                String ld = "";
                while (sc.hasNext()) {
                    line = sc.nextLine();
                    String date = line.split(";")[0];
                    if (!date.equals(ld)) {
                        instances++;
                        String price = line.split(";")[1].equals("N/A") ? "?" : line.split(";")[1];
                        String gain = line.split(";")[2].equals("N/A") ? "?" : line.split(";")[2];
                        String replacePrice = price.replace(",", ".");
                        String replaceGain = gain.replace(",", ".");
                        String toSave = instances + "," + djiaData[instances - 1] + "," + nasdaqData[instances - 1] + "," + eurostoxxData[instances - 1] + "," + dollarData[instances - 1] + "," + euroData[instances - 1] + "," + replaceGain + "," + replacePrice + "\r\n";
                        result += toSave;
                        for (Node n : indices) {
                            if (n.getKey().equals(in)) {
                                n.value[instances - 1] = replacePrice;
                                break;
                            }
                        }
                    }
                    ld = date;
                }
            } catch (FileNotFoundException ex) {
                Logger.getLogger(Reader.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        result = "%" + instances + "\r\n" + result;

        try {
            File f = new File("src/datas/indices/" + indexName + "/" + indexName + ".arff");
            f.delete();
            f.createNewFile();
            PrintWriter out = null;
            out = new PrintWriter(new BufferedWriter(new FileWriter("src/datas/indices/" + indexName + "/" + indexName + ".arff", true)));
            out.print(result);
            out.close();
        } catch (IOException ex) {
            Logger.getLogger(Reader.class.getName()).log(Level.SEVERE, null, ex);
        }
    }