For many travelers, the simplest solution is to purchase a JR Pass (countrywide) that fits the length of their stay in Japan (1, 2 or 3 weeks) as it offers many advantages and is easy to use.
For travelers with a tighter budget, it is preferable to think about a detailed itinerary to optimize travels on a short period: for example, only 14 days of travel on a 20-days stay. However, it imposes a little bit more planning and does not leave space for impromptu.
If you have difficulty choosing between two durations (for example between 7 and 14 days), most of the time, the best option is to choose the longest. It is indeed the more comfortable solution, as it offers: