'Index 1 out of bounds for length 1 in splitted Array

I am having an issue with my Java programm. It is telling me that my Array is out of bounds. NOTE: I splitted an array at NEW LINES then I splitted the array in a for each loop at TABULATOR SPACES. Could you please help me? *THE METHOD readAllLinesFromDict is reading from a text file.

Here is a piece of my code:

 private static String[] getWords(int minFreq){

    String words = readAllLinesFromDict();
    String [] splittedWords = words.split("\t");
    boolean check = true;
    
    StringBuilder newWords = new StringBuilder();
 

        for (String line:splittedWords) {
            String wds[] = line.split("\t");
            
            
            
            if (wds[0].length() != 5)
                continue;
            if (!wds[1].equals("NoC"))
                continue;
            if (Integer.parseInt(wds[2]) < minFreq)
                continue;
            
            for (int i = 0; i < wds[0].length(); i++) {
                if (!(Character.isLetter(wds[0].charAt(i)) || wds[0].endsWith("s")))
                    check = false;
            }
        
            if (check == true)
            newWords.append(wds[0] + ":");
            
    }
    
   
    return newWords.toString().split(":");
 
    
  }

Here is a piece of my text file (words.txt):

the Det 61847
of  Prep    29391
and Conj    26817
a   Det 21626
in  Prep    18214
to  Inf 16284
it  Pron    10875
is  Verb    9982
to  Prep    9343
was Verb    9236
I   Pron    8875
for Prep    8412
that    Conj    7308
you Pron    6954
he  Pron    6810
be* Verb    6644
with    Prep    6575
on  Prep    6475
by  Prep    5096
at  Prep    4790
have*   Verb    4735
are Verb    4707
not Neg 4626
this    DetP    4623
's  Gen 4599



Solution 1:[1]

Try to replace the second line of method

String [] splittedWords = words.split("\n");

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 yuri777