I know i have some real problems with the following code (as others said). can you please help me to optimize it a little bit? Maybe some example of how to do it.(find the longest repeating substring with length between x and y)    public static String longestDuplicate(String text, int x, int y){    String longest = ;    for (int i = 0; i < text.length() - 2 * longest.length() * 2; i++)    {        OUTER: for (int j = Math.min((text.length() - i -1)/2, y) ; j > longest.length() && j >=x; j--)        {            String find = text.substring(i, i + j);            for (int k = i + j; k <= text.length() - j; k++)            {                if (text.substring(k, k + j).equals(find))                {                    longest = find;                    continue OUTER;                }            }            break;        }    }    return longest;}
Optimizing code: longest repeating substring
java;optimization