Some simple statistical functions in Java