您的位置:首页 > 其它

从文件中读取数组到内存

2011-12-19 20:54 190 查看
public void readDataFromFile(int[][] data, String fileName) {
try {
BufferedReader in = new BufferedReader(new FileReader(new File(
fileName)));
String line;
int row = 0;
while ((line = in.readLine()) != null) {
String[] temp = line.split("\t");
for (int j = 0; j < temp.length; j++) {
data[row][j] = Integer.parseInt(temp[j]);
}
row++;
}
in.close();
} catch (Exception e) {
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐