When you enter Japan, you will probably be on a 90 day tourist visa exemption. Holders of certain passports (e.g. Ireland) can get this extended by an extra 90 days. You must leave the country before your exemption runs out, but you can return straight away and get another 90 days. Some people worry that the the immigration people will eventually get suspicious if you keep doing this, but I have also heard of people who have done it five times with no problems.
You’re not allowed to work in Japan without a working visa. But if you find a job and a company willing to sponsor your work visa, you can apply for the work visa and have it issued without leaving the country. A few years ago, this wasn’t possible; you’d have to apply in Japan, get some sort of form issued, and then leave the country and go to a Japanese embassy overseas to get the visa issued. Now it can all be done without leaving Japan; this is what I did in 2002.
When you finally get the visa, it will probably be be valid for either one or three years, but you won’t find out till you get it. You have to apply again for a new visa before the first one expires.
It’s important to realise that your visa lasts only until you leave Japan; once you leave the country, even if only for a holiday, you will lose the visa. To avoid this, you have to apply for a multiple-entry permit. This means your visa will last for the full period (e.g. 3 years) even if you travel outside Japan.