Roberto Grena algorithm implementation in java language in multiple threads of execution