class TimeSeriesUtil {

	public static int getMode(final int[] array) {
		HashMap<Integer, Integer> statistics = new HashMap<>();
		for (int i = 0; i < array.length; i++) {
			if (!statistics.containsKey(array[i])) {
				statistics.put(array[i], 1);
			} else {
				statistics.replace(array[i], statistics.get(array[i]) + 1);
			}
		}

		return getMaximumKeyByValue(statistics) != null ? getMaximumKeyByValue(statistics) : -1;
	}

	private  TimeSeriesUtil();

}