import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; /** * * @author Pierre-Marc */ public class Statistiques_icosaedre_tronque { /** * @param args the command line arguments */ public static void main(String[] args) { File[] f; ArrayList nets = new ArrayList<>(); String line; int N, i; String[] path; int[] Face = new int[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; f = new File(System.getProperty("user.dir")).listFiles(); for(File file : f) { if(file.toString().endsWith("random_nets.txt")) { try { FileReader fr = new FileReader(file.toString()); BufferedReader in = new BufferedReader(fr); while(!(line = in.readLine()).equals("")) { nets.add(line); } } catch(FileNotFoundException ex) { System.err.print("Erreur : "+ex); } catch (IOException ex) { System.err.print("Erreur : "+ex); } } } N = nets.size(); System.out.println("Taille de l'échantillon = "+N); for(String net : nets) { path = net.split(","); for(String s : path) { Face[Integer.parseInt(s)] ++; } } for(i=0; i<32; i++) { System.out.println(Face[i]/(62.0*N)); } } }