indexoutofboundsexception - Stars.java arrayindexoutofbounds -


I am trying to understand why I have received this error for about 3 hours and I have some help to get it Before my computer pays the price.

I am getting this error Exception in the "main" java.lang.ArrayIndexOutOfBoundsException thread: StarsTable.checkIfStar (StarsTable.java:102) on Stars.main (stars.java 20)

  import java.io.buffferedReader; Import java.io.fileReader; Import java.io.IOException; Import java.util. *; Public category stars table {Private Archieist & Lt; Integer & gt; A = New Arrestist & lt; Integer & gt; (); Private string title; Private string readLine = null; Private int rows = 0; Private integer array [] []; Public Stars Table (String Filename) {try {BufferedReader br = new BufferedReader (New FileReader (fileName)); Title = br.readLine (); While ((readLine = br.readline ()) = Faucet {System.out.println (readLine); AddArray (ReadLine); Rows ++; } Br.close (); } Hold (IOException e) {System.err.println ("File not found" "Enter the file name in the command line."); System.exit (1); }} Public String Title () {Return Title; } Public Zero addArray (string readline) {int i = 0; String [] splitLine = readLine.split ("\\ s +"); (I = 0; i & lt; splitLine.length; i ++) for {a.add (integer.valof (splitline) .tim ())); }} Public integer [] [] getArray () {toArray (); Return array; } Public zero toArray () {array = new integer [rows] [a.size () / rows]; int g = 0; {System.out.println () for (Int i = 0; I   

}

The file type is being written in the following such as Headline Line 0 0 0 1 1 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3

Number of lines and number of lines per row is not known for each line And the file is read through the command line with the main program. / P>

== array.length instead of array.length-1 , because array.length is greater than the largest index. It can also be applied to a.size () , not sure.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -