I am trying to get a clean 15 characters after and before a target word but if the word is on either side repeated in those characters, I want to select the characters only before that. In the second method "java" I am trying to do this but not being very successful. Please read code and help
The class ConditionPosition is just a wrapper. See it here:
0th suggestion: use CODE tags rather than quote tags
First suggestion: use an List of Integers rather than an array of ints. I doubt that super-speed is an issue here.
If you're using Java 5.0 or highter:
with autoboxing, you can add an int to the array
[ February 07, 2008: Message edited by: Bill Shirley ]
Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
Joined: May 09, 2002
I used code tags
I really need top-notch speed because this method will be used in applet that will be searching in thousands of files on the client. Don't worry about permissions. I have tested that already So you see I want int array.
I haven't looked at what the code does in detail, but if you're reading from that many files, then file I/O speed is going to drown out any difference there could conceivably be between using arrays and using collections.
time taken by my code with following conditions: median 469 milliseconds - BufferedReader.readLine(); // read 39245 lines // checked them all for condition if(String.toLowerCase().indexOf("behave")>-1)
median 344 milliseconds - BufferedReader.readLine();// read 39245 lines only.
125 milliseconds difference for if statement only.