Questo è il codice che ho usato:
//-------------------------------------------------------------------------------------
public class legge2 {
public static double[] legge(String documento) throws FileNotFoundException, ParseException{
DecimalFormat df=new DecimalFormat();
Scanner numero= new Scanner(new File(documento));
double[] valori=new double[100];
int i=0;
while (numero.hasNext()){
valori[i]=df.parse(numero.next()).doubleValue();
i++;
}
numero.close();
return (valori);
}
//--------------------------------------------------------------------------------------
public static void main(String[] args) throws FileNotFoundException, ParseException {
String documento="C:\\Users\\Leonardo\\Desktop\\vere_uten te1_2.txt";
....
....
}
}
}
//----------------------------------------------------------------------------------------