```
class Solution {
public boolean isOneBitCharacter(int[] bits) {
int length = bits.length;
if(bits[length - 1] == 1) return false;
return isValid(bits, length - 2);
}
private boolean isValid(int[] bits, int end) {
if(end < 0) return true;
if(bits[end] == 1) {
if(end == 0 || bits[end - 1] == 0) return false;
return isValid(bits, end - 2);
}
else {
if(end == 0) return true;
return isValid(bits, end - 1) || isValid(bits, end - 2);
}
}
}
```