我有以下程序,文件“euler8.txt”存储在项目的 src 文件夹C:\Users\john\workspace\Euler1\src\euler8.txt
中。Exception in thread "main" java.io.FileNotFoundException: euler8.txt (The system cannot find the file specified)
当我尝试运行时,我遇到了异常。
private static void euler8() throws IOException
{
int current;
int largest=0;
int c =0;
ArrayList<Integer> bar = new ArrayList<Integer>(0);
File infile = new File("C:/Users/xxxxxxxx/workspace/Euler1/euler8.txt");
BufferedReader reader = new BufferedReader(
new InputStreamReader(
new FileInputStream(infile),
Charset.forName("UTF-8")));
try
{
while((c = reader.read()) != -1)
{
bar.add(c);
}
}
finally{reader.close();}
for(int i=0; i<bar.size(); i++)
{
current = bar.get(i) * bar.get(i+1) * bar.get(i+2) * bar.get(i+3) * bar.get(i+4);
if(largest<current)
largest = current;
}
}
我现在正在看的图片 http://img163.imageshack.us/img163/7017/halpbk.png