Added support for printing means to file after running clustering to java and scala impl