[SPARK-707] Adding Java versions of Pi, LogQuery and K-Means examples