public boolean arrayInOrder(int[] array, int flag) {
		for (int i = 0; i < array.length - 2; i++) { // i is from 0 to 2nd last
			if ((flag == 0 && array[i] < array[i + 1])
					|| (flag == 1 && array[i] > array[i + 1])) {
				return false;
			}
		}
		return true;
	}