It is completely OK to wear shorts in Japan. While it may be a bit uncommon among Japanese men, especially on work days, shorts are not off-limits by any means. And they are very common among tourists in the summer.