bool isRange(int start, int end, bool value) { for (int i = start; i < end; i++) { if ((bits[i] != 0) != value) return false; } return true; }