public static List<Word> detectAllWords(int[][] crossword, String... words) {

    List<Word> result = new ArrayList<>();

    for (int zW = 0; zW < words.length; zW++) {

        char[] charsInt = words[zW].toCharArray();

        if (charsInt.length == 1) {
            for (int yS = 0; yS < crossword.length; yS++) {
                for (int xS = 0; xS < crossword[0].length; xS++) {
                    if (crossword[yS][xS] == charsInt[0]) {
                        Word word = new Word(String.valueOf(charsInt[0]));
                        word.setStartPoint(xS, yS);
                        word.setEndPoint(xS, yS);
                        result.add(word);
                    }
                }
            }
            zW++;
        }

        for (int yS = 0; yS < crossword.length; yS++) {
            for (int xS = 0; xS < crossword[0].length; xS++) {
                if (crossword[yS][xS] == charsInt[0]) {

                    for (int yE = 0; yE < crossword.length; yE++) {
                        for (int xE = 0; xE < crossword[0].length; xE++) {
                            if (crossword[yE][xE] == charsInt[charsInt.length - 1]) {

                                if (Math.abs(yS - yE) == charsInt.length - 1 && Math.abs(xS - xE) == charsInt.length - 1) {
                                    if (yS < yE && xS < xE) {
                                        int count1 = 0;
                                        for (int y1 = yS; y1 <= yE; y1++) {
                                            for (int x1 = xS; x1 <= xE; x1++) {
                                                if (crossword[y1][x1] == charsInt[count1]) {
                                                    if (y1 == yE) {
                                                        Word word = new Word(words[zW]);
                                                        word.setStartPoint(xS, yS);
                                                        word.setEndPoint(xE, yE);
                                                        result.add(word);
                                                    }
                                                } else {
                                                    y1 = yE;
                                                    break;
                                                }
                                                y1++;
                                                count1++;
                                            }
                                        }
                                    }
                                    if (yS > yE && xS > xE) {
                                        int count2 = 0;
                                        for (int y2 = yS; y2 >= yE; y2--) {
                                            for (int x2 = xS; x2 >= xE; x2--) {
                                                if (crossword[y2][x2] == charsInt[count2]) {
                                                    if (y2 == yE) {
                                                        Word word = new Word(words[zW]);
                                                        word.setStartPoint(xS, yS);
                                                        word.setEndPoint(xE, yE);
                                                        result.add(word);
                                                    }
                                                } else {
                                                    y2 = yE;
                                                    break;
                                                }
                                                y2--;
                                                count2++;
                                            }
                                        }
                                    }
                                    if (yS < yE && xS > xE) { /////////////////////////////////////////////////
                                        int count3 = 0;
                                        for (int y3 = yS; y3 <= yE; y3++) {
                                            for (int x3 = xS; x3 >= xE; x3--) {
                                                if (crossword[y3][x3] == charsInt[count3]) {
                                                    if (y3 == yE) {
                                                        Word word = new Word(words[zW]);
                                                        word.setStartPoint(xS, yS);
                                                        word.setEndPoint(xE, yE);
                                                        result.add(word);
                                                    }
                                                } else {
                                                    y3 = yE;
                                                    break;
                                                }
                                                y3++;
                                                count3++;
                                            }
                                        }
                                    }
                                    if (yS > yE && xS < xE) {
                                        int count4 = 0;
                                        for (int y4 = yS; y4 >= yE; y4--) {
                                            for (int x4 = xS; x4 <= xE; x4++) {
                                                if (crossword[y4][x4] == charsInt[count4]) {
                                                    if (y4 == yE) {
                                                        Word word = new Word(words[zW]);
                                                        word.setStartPoint(xS, yS);
                                                        word.setEndPoint(xE, yE);
                                                        result.add(word);
                                                    }
                                                } else {
                                                    y4 = yE;
                                                    break;
                                                }
                                                y4--;
                                                count4++;
                                            }
                                        }
                                    }
                                }
                                if (Math.abs(yS - yE) == charsInt.length - 1 && Math.abs(xS - xE) == 0) {
                                    if (yS < yE) {
                                        int count5 = 0;
                                        for (int y5 = yS; y5 <= yE; y5++) {
                                            if (crossword[y5][xS] == charsInt[count5]) {
                                                if (y5 == yE) {
                                                    Word word = new Word(words[zW]);
                                                    word.setStartPoint(xS, yS);
                                                    word.setEndPoint(xE, yE);
                                                    result.add(word);
                                                }
                                            } else {
                                                break;
                                            }
                                            count5++;
                                        }
                                    }
                                    if (yS > yE) {
                                        int count6 = 0;
                                        for (int y6 = yS; y6 >= yE; y6--) {
                                            if (crossword[y6][xS] == charsInt[count6]) {
                                                if (y6 == yE) {
                                                    Word word = new Word(words[zW]);
                                                    word.setStartPoint(xS, yS);
                                                    word.setEndPoint(xE, yE);
                                                    result.add(word);
                                                }
                                            } else {
                                                break;
                                            }
                                            count6++;
                                        }
                                    }
                                }
                                if (Math.abs(yS - yE) == 0 && Math.abs(xS - xE) == charsInt.length - 1) {

                                    if (xS < xE) {
                                        int count7 = 0;
                                        for (int x7 = xS; x7 <= xE; x7++) {
                                            if (crossword[yS][x7] == charsInt[count7]) {
                                                if (x7 == xE) {
                                                    Word word = new Word(words[zW]);
                                                    word.setStartPoint(xS, yS);
                                                    word.setEndPoint(xE, yE);
                                                    result.add(word);
                                                }
                                            } else {
                                                break;
                                            }
                                            count7++;
                                        }
                                    }
                                    if (xS > xE) {
                                        int count8 = 0;
                                        for (int x8 = xS; x8 >= xE; x8--) {
                                            if (crossword[yS][x8] == charsInt[count8]) {
                                                if (x8 == xE) {
                                                    Word word = new Word(words[zW]);
                                                    word.setStartPoint(xS, yS);
                                                    word.setEndPoint(xE, yE);
                                                    result.add(word);
                                                }
                                            } else {
                                                break;
                                            }
                                            count8++;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    System.out.println(result);
    return result;
}