4 different states: 0: success; 1: require at least one more bit(false); 2: false; 3: ambiguous(false)

```
class Solution {
public boolean isOneBitCharacter(int[] bits) {
int state=0;
for(int i=0;i<bits.length;i++){
if(state==0){
state=bits[i];
}
else if(state==1){
state<<=1;
state+=bits[i];
}
else {
state=bits[i];
}
}
return state==0;
}
}
```