Hi
I got the error for possibleseq array . The error is java.lang.NullPointerException. As java doesn't support pointer, when want to use dynamic array, how I can use. The array length cannot know exactly . It depends on the possible subsequences. So, Do I count the possible sequences in advance and only after getting that, I create possible seq array with new operator? Is there other ways without counting array length in advance? Thanks in advance.
private void DiscoverSeqPattern(String seq, int repnum)
{
String[] possibleseq = null;
String temp;
int i=0,j;
//seq = "title author author editor";
//repnum = 2;
//subseq = {title,author,author,editor"};
String[] subseq = seq.split("\\s"); //split seq into subseq with space
while ((i<subseq.length) && ((i+repnum-1)<subseq.length))
{
temp = subseq[i];
for (j=i+1;j<i+repnum;j++)
{
temp = temp.concat(" ").concat(subseq[j]);
}
possibleseq[i] = temp;
i++;
}
}