The UK is far stricter that other countries with "fair dealing".
Also, while what you did was possibly illegal you're not a criminal. People could sue you for loss of earnings, but the police (and fines and criminal records) only get involved if you are selling what you're copying.
In US you would argue fair use while the book publisher would argue that you infringed their copyright by harming the market for that book. Once you scan the book, you no longer have any need to buy it, thus they loose an extra sale. Of course, practically speaking, as long as you don't go around selling your newly scanned copy of said book to all of your classmates, you shouldn't run into any problems.
At my university we can just keep the book for the whole semester.. so the students here rarely buy books anyway (except when the library is selling it's old books.. lots of bargains to be had :).
In general copyright violation as part of trade is what gets police and criminal courts involved, but that doesn't mean copyright violation for personal use is legal.
"Format shifting" tends to be not legal but ignored by everyone. In the UK for at shifting is changing status from not legal to legal. "Time shifting" was written i to law as being allowed because otherwise VCRs would have been ridiculous.
It depends on the country. Guessing from the username, sampo is propably Finnish (like myself) and in Finland you are allowed to make a few private copies of any legally produced and distributed books/media (such as a book borrowed from a library) unless it's protected by an "effective technical protection" (so, if you download a non-DRMed movie from a site where it is legally distributed, you can make private copies). Private copy means a copy used by yourself, your family or close friends.