A singlethread and multithread Java implementation of the Monte Carlo algorithm