I am reading text files of some 400 lines in length of say 50 characters a line.
I parse the lines using below into a string array
mybits= Regex.Split(",",myline)
A couple of the fields need conversation to Integers but the more I run the program, looping the same files and making different choices I start getting string errors
java.lang.StringIndexOutOfBoundsException
at org.apache.harmony.luni.util.FloatingPointParser.initialParse(FloatingPointParser.java:117)
at org.apache.harmony.luni.util.FloatingPointParser.parseDouble(FloatingPointParser.java:281)
at java.lang.Double.parseDouble(Double.java:287)
I used a simple expression myinteger = mybits(5) to implicitly do conversion
BUT whilst it initially, i.e. 1st pass of program, runs ok the more I loop the more errors I get. I used Try/Catch loops and simply try conversion a 2nd time and it works ! or even a 3rd ...
BUT this is terrible programming. Why JAVA wants to make simple strings like "123" a double before converting to Integer 123 I don't know and I remember seeing posts here about simple integer conversion.
It would seem to me to be some sort of "like a memory leak"... I keep consuming memory with string manipulation and then it gets very bad.
Is there a way to FORCE garbage collection of memory ?? or a better way to do the Integer conversion ??
I parse the lines using below into a string array
mybits= Regex.Split(",",myline)
A couple of the fields need conversation to Integers but the more I run the program, looping the same files and making different choices I start getting string errors
java.lang.StringIndexOutOfBoundsException
at org.apache.harmony.luni.util.FloatingPointParser.initialParse(FloatingPointParser.java:117)
at org.apache.harmony.luni.util.FloatingPointParser.parseDouble(FloatingPointParser.java:281)
at java.lang.Double.parseDouble(Double.java:287)
I used a simple expression myinteger = mybits(5) to implicitly do conversion
BUT whilst it initially, i.e. 1st pass of program, runs ok the more I loop the more errors I get. I used Try/Catch loops and simply try conversion a 2nd time and it works ! or even a 3rd ...
BUT this is terrible programming. Why JAVA wants to make simple strings like "123" a double before converting to Integer 123 I don't know and I remember seeing posts here about simple integer conversion.
It would seem to me to be some sort of "like a memory leak"... I keep consuming memory with string manipulation and then it gets very bad.
Is there a way to FORCE garbage collection of memory ?? or a better way to do the Integer conversion ??