algorithms descripted by Java