public static int majorityElement(int[] arr) {
		if(arr.length == 0 || arr.length == 1) {
			System.out.println("Error: Input array's length is less than 2.");
			System.exit(0);
		}
		Integer count;
		Map<Integer, Integer> map = new HashMap<Integer, Integer>();
		for(int i = 0; i < arr.length; i++) {
			if((count = map.get(arr[i])) != null) {
				count += 1;
				map.put(arr[i], count);
			}
			else
				map.put(arr[i], 1);
			count = 0;
		}
		for(Map.Entry<Integer, Integer> me : map.entrySet()) {
			if(me.getValue() > arr.length/2)
				return me.getKey();
		}
		return Integer.MIN_VALUE;
	}