在代码中获取ArrayIndexOutOfBoundsException:0错误

时间:2017-10-06 15:34:41

标签: java indexoutofboundsexception

我正在运行如下代码:

java -cp dream.jar:. pro.dr16.Interval ".*.gz" ./name/ flagfold 2,3 
[0, 2]
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at projects.dream2016.Interval.main(SpecificOrConserved2Interval.java:101)    

,实际代码如下所示

 public static void main(String[] args) throws FileNotFoundException, IOException {
            FilenameFilter filter = new RegExFilenameFilter("", Directory.FORBIDDEN, true, args[0] );
            String[] fName = new File( args[1] ).list(filter);
            String[] s = args[2].split(",");
            int[] cols = new int[s.length];
            for( int i = 0; i < cols.length; i++ ) {
                    cols[i] = Integer.parseInt( s[i] );
            }

我是广泛的java代码的新手,任何帮助/建议都会很棒。

0 个答案:

没有答案