I want to transfer value of even indexed array(pos) to an arraylist(words), everytime pos has two or more value i get OutOfMemoryError. Is something wrong? Because I get OutOfMemoryError: Java heap space
ArrayList<String> token = new ArrayList<String>();
ArrayList<String> words = new ArrayList<String>();
for (String a : token)
{
temp = temp + " " + a;
pos = a.split("[_\\s]+");
}
int c=0;
for(int i=0; i<=pos.length; i+=2) {
words.add(pos[i]);
c++;
}
posdefined? what is the content oftokentoken. Then only we can solve yourjava.lang.ArrayIndexOutOfBoundsException