I have a code like this:
RandomAccessFile raf = new RandomAccessFile(new File("C:\\Users\\AhmadMaleki\\IdeaProjects\\Hello world\\src\\kish\\file1"), "r");
for (int i = 1 ; i < 1025 ; i++)
{
for (int j = 0; j < raf.length() - 4 ; j++)
{
raf.seek(j);
byte[] b = new byte[5];
raf.read(b);
if (new String (b).equals(wordcount[i]))
{
z[i]++;
}
}
}
In this Code raf.length() = 26841039 and execution time is 4100 minutes. Are there solutions to reduce run time?(for example multi thread, parallel, ....)