Convert state to int