This algorithm has been in my mind for a long time, but I cannot find it described anywhere. It\'s so simple though that I can\'t be the only one who has thought of it. Here\'s
The algorithm you have stated is called an area-averaging algorithm, it is an algorithm which is seldom applied for shrinking images.
A simpler variant of it is used as an anti-aliasing technique for smoothing rendered images in computer games.
The algorithm for this technique is called Supersampling
Thanks to @Guffa for pointing it out, it is a simplification of the above algorithm, as it takes sample points and it could miss out on certain colors, or choose one color more times than another even though its not most dominant.
The algorithm above is equal to an infinite points sampling of the supersampling algorithm.
Update:
Just noticed that even Java appreciates your algorithm :)
AreaAveragingScaleFilter