It is a bit unusual. And strange, by the way. If your employer has no work for you, why does he force you to come to the office?
Improve your code
In general, there is always a work to do, even on a single project. If you have nothing to do, it means that your project is perfect. I don't believe in perfect projects, since I've never saw any. If your company has perfect projects, I wish I could take a look at how is it done.
If your project is not perfect, than you can spend this free time improving it.
- Enforce the coding style rules,
- Check if the comments are up-to-date and are not missing anywhere,
- Do code review on parts which were not written by you,
- Improve technical documentation,
- Profile the code to see what are the bottlenecks and how to remove them,
- Refactor your code,
- Start to think about future features to implement.
Learn something new
Sometimes, you have just finished coding, you finally released the project, and the last thing you want to do is to continue to work with the code you've been on for the last three months. That's understandable. In this case, you can easily find another occupation to change your ideas and increase your knowledge. For example if you're a C# developer, learn Python, or learn how to use Reactive Extensions, or whatsoever.
You may also be tempted to do a small project for yourself during your free time. I don't advise to do that, not only because the code you write at your work generally belongs to your company, but also because you can be sued to use your enterprise hardware and other resources to do projects that has nothing to do with your actual work.
Talk to your boss
It may be a good idea to ask the question you asked on Programmers.SE to the concerned person, i.e. your boss. In fact, chances are that:
- Either he ignores that the developers have sometimes nothing to do,
- Or he expects you to do a precise thing.
It is especially important to know what is the situation if your boss actually expects you to do something. For example, if I had employees, I would expect them to improve the project when they have finished writing code and resolving bugs. In the same way, when I work for a company at place, I always spent all the time working on the project and improving it if there were no bugs to resolve.
There is one exception: interns usually are not expected to do additional work on their own. But at least we expect them to come and tell us when they finished what we asked them to do, so that we assign them another task.