You can buy this project and download/modify it how often you want.
Files of the artifact sos-statistics version 6.0.0-PR.2 from the group org.n52.sensorweb-server.sos.