It doesn't happen that often but it does happen. Foreign residents are required to carry a resident card at all times and the police are allowed to check for it. This can come with a search.
Japanese nationals don't need to carry any form of ID by law, so you can see that how the police choose who to stop might be somewhat problematic.