Implementation of Roberto Grena algorithm in java language using one thread of execution.