Down sampling in Java as demonstrated by Sveinn Steinarsson in his masters thesis