public static String checkDomain(String url) { String[] domain = new String[2]; if (url.endsWith("ru") || url.endsWith("com") || url.endsWith("org") || url.endsWith("net")) { domain = url.split("."); return domain[domain.length - 1]; } return "неизвестный"; } Подскажите, почему все время ArrayIndexOutOfBoundsException и domain.length равна нулю??