用动态和静态设计一个网站,没地址怎么注册公司,网页设计教程网站,wordpress ico更改貌似遇到问题了#xff0c;在Java中#xff0c;parseInt方法是java.lang.Integer类的一个静态方法#xff0c;它用来将字符串转换为基本数据类型int。如果字符串不能被解析为有效的整数#xff0c;parseInt会抛出一个NumberFormatException。 原来是取整串转换#xff0c;… 貌似遇到问题了在Java中parseInt方法是java.lang.Integer类的一个静态方法它用来将字符串转换为基本数据类型int。如果字符串不能被解析为有效的整数parseInt会抛出一个NumberFormatException。 原来是取整串转换以为是取第一个字符 所以这里需要分割字符串函数split或者转换为数组 采用第二种结果 应用于个人项目
public static void inHistryWork() {FileInputStream fis null;try {fis new FileInputStream(src\\Io\\histrywork.ser);} catch (FileNotFoundException e) {e.printStackTrace();}BufferedReader reader new BufferedReader(new InputStreamReader(fis));while (true) {try {String line reader.readLine();if (line null) break;//String num Arrays.toString(line.split(\\s));char[] chars line.toCharArray();int a Integer.parseInt(chars[0] );histryworkmap.put(a - 1, line);//Byte [] bytesnew Byte[1024];} catch (FileNotFoundException e) {e.printStackTrace();break;} catch (IOException e) {e.printStackTrace();break;}}}