📄 cityinfo.java
字号:
package test;import java.io.*;import java.util.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class CityInfo {// int cityCount = 24978; int cityCount = 100;// int cityCount = 724; double[] xcoords; double[] ycoords; public CityInfo() { } public void readCoords() { xcoords = new double[cityCount]; ycoords = new double[cityCount]; try { BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(cityCount+".txt"))); for (int i = 0; i < cityCount; i++) { String line = br.readLine(); if (line == null) { break; } StringTokenizer st = new StringTokenizer(line, " "); String index = st.nextToken(); xcoords[i] = Double.parseDouble(st.nextToken()); ycoords[i] = Double.parseDouble(st.nextToken());// System.out.println("read coord " + index + " " + xcoords[i] + " " + ycoords[i]); } br.close(); } catch (Exception ex) { ex.printStackTrace(); } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -