As in any country you visit, follow the local laws to the letter to avoid any unfortunate mishaps or misunderstandings.
Make sure you are aware of the local laws in Japan as ignorance is not accepted as a valid line of defense. While you should be mindful of the following, thorough research through the proper channels is strongly recommended.
Be sure to carry your passport with you at all times as a form of identification. The chances are you won't need to show it, but there is always a chance that you may be required to do so.
Smoking is still allowed in most restaurants and bars, however, smoking outside of designated areas is not. This rule is strictly enforced—especially in the country's main cities—and can result in a fine, so don't walk and smoke, find a smoking area.
Drinking outside on the other hand doesn't violate any laws—in fact, it's part of the culture, especially during the hanami season in spring when picnics under the cherry blossoms are common. However, while this might be the case, loud and boisterous behavior is not part of Japanese culture, so try to keep any outdoor partying under control. Be sure to take any litter home with you.
The issue of tattoos is a thorny one in Japan. Having a historical association with organized crime, many public swimming pools, public baths, hot spring resorts, and gyms prohibit entry to anyone with tattoos—even small ones. The rules are loosening slightly, and some establishments will simply ask you to cover any tattoos up. Research in advance to avoid any disappointment.
There is zero tolerance towards any kind of drug-related crime. Simply put, just don't do it.