If you're frequently finding yourself with nothing to do at work, either your managers are failing at their primary job of delegating work or you're not realizing that there are useful things you can do that you weren't explicitly assigned (refactoring code, researching technology that can be useful to your team, writing more tests, etc.).