public static String[] ReadFile(File file) throws IOException
{
BufferedReader br = null;
List<String>list=new ArrayList<String>();
FileReader fileReader=new FileReader(file);
BufferedReader buf=new BufferedReader(fileReader);
int i=0;
String str=null;
while((str=buf.readLine())!=null)
{
list.add(readLine);
i++;
if(i==2000000)//文件太大,读到2000000就被停止了
break;
}
buf.close();
return list.toArray(new String[0]);
}
为什么list.toArray(new String[0])????(总结来自