Сумасшедшая ошибка
String[] result = yourString.split("-");
if (result.length != 2)
throw new IllegalArgumentException("String not in correct format");
Average Anaconda